note 71022 deleted from function.is-int by nlopess
| From: | nlopess@php.net | Date: | Wed, 08 Nov 2006 22:55:14 +0000 |
| Subject: | note 71022 deleted from function.is-int by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-119529@lists.php.net to get a copy of this message | ||
Note Submitter: mikko at sorl dot net
Reason: useless
----
I created and used this function:
<?php
function is_natural($x) {
return (string)$x === (string)(int)abs($x);
}
?>
It returns TRUE if the argument is a natural number (including 0) even if the argument is a string
such as "666".