Why does in_array() wrongly return true with these (large numeric) strings?

后端 未结 9 2167
夕颜
夕颜 2020-12-08 00:35

I am not getting what is wrong with this code. It\'s returning \"Found\", which it should not.

$lead = \"418176000000069007\";
$diff = array(\"41817600000006         


        
9条回答
  •  悲哀的现实
    2020-12-08 01:05

    Try using brackets and use strict mode:

    $lead = "418176000000069007";
    $diff = array("418176000000069003","418176000000057001");
    
    if(in_array($lead, $diff, true)) {
        echo "Found";
    } else {
        echo "Not found";
    }
    

提交回复
热议问题