Justin French <[EMAIL PROTECTED]> wrote: > 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)) ) > I did some more tests on this problem is that $str is still considered a string and not an integer here is my test script and results:
<?php // is_int() testing // standard string $str = "123"; if (is_int($str)) print "$str: yes \n"; else print "$str: no \n"; //cast to integer $str = (integer)"123"; if (is_int($str)) print "$str: yes \n"; else print "$str: no \n"; // implied cast to integer $str = "123"; $str += 0; if (is_int($str)) print "$str: yes \n"; else print "$str: no \n"; // force to be integer $str = "123"; settype($str, 'integer'); if (is_int($str)) print "$str: yes \n"; else print "$str: no \n"; /* Results: 123: no 123: yes 123: yes 123: yes */ ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php