note 55684 added to function.ereg

From: Date: Wed, 10 Aug 2005 15:13:11 +0000
Subject: note 55684 added to function.ereg
Groups: php.notes 
Request: Send a blank email to php-notes+get-93378@lists.php.net to get a copy of this message
concerning the 'valid postal code' bit from 25 july - regular expressions are good for turning the longer zip checking code given below into much shorter snippets, such as the following (which accomplishes the same zip code check): $error_code=(ereg("^[0-9]{5}(-[0-9]{4})$",$zip))? NULL:1; the expression requires the first five digits and allows an additional four; the hyphen is required if the optional four are present ---- Manual Page -- http://www.php.net/manual/en/function.ereg.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+55684 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+55684&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+55684&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+55684&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+55684&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+55684&report=yes&reason=non-english Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+55684&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+55684&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#93378) next »