It might be more reliable to add or subtract 0 from the "string" and see if it changes. Something like:
if( (strlen($str)==6) && ( strcmp(($str-0),$str)==0))
It may just be easier to use ereg if you won't be looping through a bunch of numbers. I don't know what the performance difference is between the above function and ereg or preg.
On Wednesday, July 16, 2003, at 09:43 AM, Justin French wrote:
I tested
if( (strlen($str) == 6) && (is_int($str)) )
vs
if(ereg('^[0-9]{6}$',$str))
-- Brent Baisley Systems Architect Landover Associates, Inc. Search & Advisory Services for Advanced Technology Environments p: 212.759.6400/800.759.0577
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php