|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
  [2001-02-16 18:35 UTC] krssak at upc dot uniba dot sk
 $id_size=strlen($id_usr);
if (!ereg("([0-9]{$id_size})",$id_usr)){
  echo "Error ID";
}
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 03:00:01 2025 UTC | 
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"; }