In_array not working

You need to cast them all first, then search. Like this:

$new_arr = array_map(function($piece){
    return (string) $piece;
}, $arr);

// then use in array
if(in_array('285078', $new_arr)) {
    echo 'exists';
} else {
    echo 'does not exists';
}

Leave a Comment