note 85544 rejected from function.in-array by thiago
| From: | thiago@php.net | Date: | Fri, 05 Sep 2008 13:58:38 +0000 |
| Subject: | note 85544 rejected from function.in-array by thiago | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-144160@lists.php.net to get a copy of this message | ||
Note Submitter: raven990862 at gm@il
----
Quick note:
<?php
$a = array('999999999999999999');
if(in_array('999999999999999990',$a))
{
echo "true";
}
?>
prints a true to the screen
---
<?php
$a = array('999999999999999999');
if(in_array('999999999999999990',$a,true))
{
echo "true";
}
?>
does not print anything
Some would call this a bug, Some would not...
What I think is happening is in_array is converting the strings to floats and truncating the least
significant part of the value.