Re: checkng if string is a number

From: Date: Thu, 17 Nov 2005 20:00:22 +0000
Subject: Re: checkng if string is a number
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-226006@lists.php.net to get a copy of this message
If I misunderstood the intval part of your post, than the [proposed already] is_numeric solutions are the way to go. is_numeric will, however, unlike the conversion functions, return false if there's anything but a number in the string, so, i.e., is_numeric ("10a1") will return false, but intval ("10a1") will give "10".

« previous php.general (#226006) next »