Re: Regular Expression for a UK Mobile
| From: | Gareth Williams | Date: | Fri, 15 Oct 2004 12:49:43 +0000 |
| Subject: | Re: Regular Expression for a UK Mobile | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-199586@lists.php.net to get a copy of this message | ||
You could add is_integer() into the if statement.
On 15 Oct 2004, at 14:07, Robert Cummings wrote:
On Fri, 2004-10-15 at 07:45, Gareth Williams wrote:Do you even need a regex? What about if (strlen($_POST['mobile_number']) != 11 && substr($_POST['mobile_number'],0,3) != 447) { $error="Invalid Number"; }This doesn't verify that the portion following 447 is also a number.eg. 4474567X901Cheers, Rob. -- .------------------------------------------------------------. | InterJinn Application Framework - http://www.interjinn.com | :------------------------------------------------------------: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn || also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. |`------------------------------------------------------------' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php