Re: Verifying a certain amount of numbers

From: Date: Wed, 16 Jul 2003 13:43:19 +0000
Subject: Re: Verifying a certain amount of numbers
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-155419@lists.php.net to get a copy of this message
If you care about performance at all, try and find away around the problem without regular expressions... I tested if( (strlen($str) == 6) && (is_int($str)) ) vs if(ereg('^[0-9]{6}$',$str)) ...on my LAN test server with 100000 iterations, and the regexp was nearly 2 times slower than the first solution. IMHO, it's also faster to read and modify the first solution too -- especially for those with minimal regexp experience. Justin On Wednesday, July 16, 2003, at 11:07 PM, Ron Allen wrote:
I would like to know how to verify that there are 6 numbers (only numbers in a field) that will be submitted to a database? Any clues!


« previous php.general (#155419) next »