According to the PHP manual, the function eregi:
"Returns the length of the matched string if a match for pattern was found in string"
The following code..
Code: Select all
$thing = 'happybirthdaytoyou';
$result = (eregi ('^[[]\.\' \-]{2,30}$', $thing));
echo $result;to the browser. Does this mean it is only matching the first character in $thing?1
If so, then why does introducing illegal characters in to $thing..
Code: Select all
$thing = 'happy&&birthdaytoyou';
$result = (eregi ('^[[]\.\' \-]{2,30}$', $thing));
echo $result;Is there a typo in the PHP manual? Should it instead read "Returns the number of matched patterns found in string".
If the first example of my code returned the length of the entire string, that would make sense. But it didn't.
So what's going on?
Thanks.