Bug #9309 Updated: update ereg function to return booleans instead of 0/1
| From: | jimw@php.net | Date: | Sat, 27 Apr 2002 18:49:51 +0000 |
| Subject: | Bug #9309 Updated: update ereg function to return booleans instead of 0/1 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-6262@lists.php.net to get a copy of this message | ||
ID: 9309
Updated by: jimw@php.net
Reported By: krssak@upc.uniba.sk
-Status: Analyzed
+Status: Closed
Bug Type: Feature/Change Request
Operating System: debian linux
PHP Version: 4.0.3pl1
New Comment:
ereg() does return false when no matches are made, or the length of the
match.
Previous Comments:
------------------------------------------------------------------------
[2001-02-16 23:19:24] andre@php.net
a) in fact is does return 1 and 0, that isn't exactly true
and false in php 4 anymore, either documentation or regex
code needs a small update... moving to change request
b) your problem is another, your regex is wrong, try echoing
your pattern before passing it to ereg() and you will see
that php ate up your brackets (eg. [0-9]2)
it should read like this:
if (!ereg('([0-9]{'.$id_size.'})',"$id_usr")){
echo "Error ID";
}
------------------------------------------------------------------------
[2001-02-16 18:35:03] krssak@upc.uniba.sk
$id_size=strlen($id_usr);
if (!ereg("([0-9]{$id_size})",$id_usr)){
echo "Error ID";
}
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=9309&edit=1