Ensuring that variable contains a number

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



How can I ensure that a variable contains a postive integer number?
I'm currently using this code:

$number=(10000-$number);
$number=(10000-$number);
if ( $number<1 ) { $number=1; }

But I'm sure that there is a better way. What would that be?

Dotan Cohen

http://what-is-what.com/what_is/internet.html
http://song-lirics.com/

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux