note 71320 deleted from function.ereg by tularis
| From: | tularis@php.net | Date: | Thu, 31 May 2007 13:19:32 +0000 |
| Subject: | note 71320 deleted from function.ereg by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-127054@lists.php.net to get a copy of this message | ||
Note Submitter: mathieu dot guilbaud at NOSPAM dot univ-lehavre dot fr
----
The documentation of the ereg function doesn't explain correctly the return code :
* if the third argument is provided the return code is equal to the number of characters that
matches the regexp
* if the third argument is not provided the return code is a boolean (0 or 1)
The following code :
<?php
echo strlen("a-b.c@example.com") . "<br>";
echo ereg("[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z]+", "a-b.c@example.com",
$tab) . "<br>";
echo ereg("[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z]+", "a-b.c@example.com") .
"<br>";
?>
returns
17
17
1