note 71320 added to function.ereg

From: Date: Wed, 22 Nov 2006 14:58:10 +0000
Subject: note 71320 added to function.ereg
Groups: php.notes 
Request: Send a blank email to php-notes+get-119977@lists.php.net to get a copy of this message
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 ---- Server IP: 217.174.203.10 Probable Submitter: 193.48.167.33 ---- Manual Page -- http://www.php.net/manual/en/function.ereg.php Edit -- https://master.php.net/note/edit/71320 Del: integrated -- https://master.php.net/note/delete/71320/integrated Del: useless -- https://master.php.net/note/delete/71320/useless Del: bad code -- https://master.php.net/note/delete/71320/bad+code Del: spam -- https://master.php.net/note/delete/71320/spam Del: non-english -- https://master.php.net/note/delete/71320/non-english Del: in docs -- https://master.php.net/note/delete/71320/in+docs Del: other reasons-- https://master.php.net/note/delete/71320 Reject -- https://master.php.net/note/reject/71320 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#119977) next »