note 26745 modified in function.intval by maxim
| From: | maxim@php.net | Date: | Mon, 11 Nov 2002 19:44:03 +0000 |
| Subject: | note 26745 modified in function.intval by maxim | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-39309@lists.php.net to get a copy of this message | ||
intvar() will take a variable an chop off everything when it hits a non-int character
For example:
$var=intval("122a5");
//$var==122
example 2:
$var=intval("122.5");
//$var==122
This is nice if you want to turn a double into an int automatically rounding down
[editor note:
Functions ceil() and floor() should be used to turn floats into integers
Maxim]
--was--
intvar() will take a variable an chop off everything when it hits a non-int character
For example:
$var=intval("122a5");
//$var==122
example 2:
$var=intval("122.5");
//$var==122
This is nice if you want to turn a double into an int automatically rounding down
http://www.php.net/manual/en/function.intval.php