> Vlad Georgescu wrote:
>
>> how can test if var $int is integer ?
>
> In the manual:
>
>    http://www.php.net/is_int
>
> Another one which might be helpful:
>
>    http://www.php.net/is_numeric
>
>
> Hope this helps,
>
> Torben
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

I recently purchased George Schlossnagle's Advanced PHP Programming and on
page 85 in the Error Handling chapter, he made a reference about the
is_int function.

In the above function example he had:
if (!preg_match('/^\d+$/',$n) || $n < 0) {....

In which he mentions:
It might be strange to choose to evaluate whether $n is an integer by
using a regular expression instead of the is_int function. The is_int
function, however, does not do what you want. It only evaluates whether $n
has been typed as a string or as an integer, not whether the value of $n
is an integer.

Can anyone comment on this?

--Matthew Sims
--<http://killermookie.org>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to