Welcome to WebmasterWorld Guest from 184.108.40.206
would be better written as
Also, just for readability, it might be better to use real type casting:
$age = (int) $nonIntChar;
$age = <non-integer character> * 1
But both those points are splitting hairs ;)
Using Perl Regexp in PHP is generally un-optimal; better to use lower level string functions or integer casting and a regular conditional.
I used to think this as well. As a matter of fact, most of the PHP function pages will even state as such. However, in my recent testing with PHP5 I have found PCRE to be faster. Perhaps it is the new engine or otherwise but I just wanted to share my experiences.