I am not getting what is wrong with this code. It’s returning “Found”, which it should not.
$lead = "418176000000069007";
$diff = array("418176000000069003","418176000000057001");
if (in_array($lead,$diff))
echo "Found";
else
echo "Not found";
Note: This was a bug in PHP old versions and is corrected in
PHP 5.4and newer versions.It is because of the limitations of the number storage in
PHPThe real problem here is because of the
PHP_INT_MAX– the value exceeded in our case.Try to
echo/print_r$leadand$diffwithout using the quotes. It will resultso, in this case, the
in_arrayresult is true!so use
strictcomparison inin_array()by setting third argument inin_array()astrueTry this. It will work.