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";
I think it is because of the limitations of the number storage. The values exceed PHP_INT_MAX.
Try without using the quotes, and try to echo the values of the variables. It will result in something like
$lead ---> 418176000000070000
$diff ---> Array ( [0] => 418176000000070000 [1] => 418176000000060000 )
so in this case the in_array result is true!
<?php
$lead = "418176000000069007";
$diff = array("418176000000069003","418176000000057001");
if(in_array($lead,$diff,true)) //use type too
echo "Found";
else
echo "Not found";
?>
Try this. It will work.
