Re: integer checking problem from query string
| From: | Steven Haryanto | Date: | Sun, 29 Apr 2001 12:08:00 +0000 |
| Subject: | Re: integer checking problem from query string | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-50798@lists.php.net to get a copy of this message | ||
Because it's a string. You can use regex matching or test
whether floor($var) == $var, for example.
Steve
At 4/29/2001 04:25 AM, Jamie Saunders wrote:
Hi, I'm submitting a phone number from an HTML form to a PHP page that examines it to see if it's an integer: form.html: validate.php: <?php $phonenumber = trim($phonenumber); if (is_int($phonenumber)) { echo "Integer"; } else { echo "Not Integer"; } ?> However, for some reason the script doesn't recognize the number as an Integer - why is this and how can I remedy it? Jamie Saunders Mail: webprogramming@jamie-s.co.uk Web: http://jamie-s.co.uk