in reply to Re: Checking whether a $var is a numberin thread Checking whether a $var is a number
I think you have a typo in your substr which should be
substr($x,0,1); [download]
Otherwise the case $x=0; falls into the not a number part of the if.