note 115362 deleted from function.intval by cmb
| From: | cmb@php.net | Date: | Sun, 16 Feb 2020 13:47:05 +0000 |
| Subject: | note 115362 deleted from function.intval by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-214135@lists.php.net to get a copy of this message | ||
Note Submitter: nlong121 at gmail dot com
----
As a note using intval() as a check for string comparison will not work
$string="Pork";
$test=intval($string);
echo $test.'=='.$string;
if($string==$test)
{
echo '::Test PASS';
}else{
echo '::Test FAIL';
}
if(is_numeric($string))
{
echo '::Test PASS';
}else{
echo '::Test FAIL';
}
/*Produces
0==Pork :: Test PASS
is_numeric(Pork) :: Test FAIL