PHP is always returning false when I use in_array(), and whether it is or isn't in the array doesn't matter. For example:
$list = 'test
list
example';
$list_arr = array();
$list_arr = explode("\n",$list);
if (in_array('test',$list_arr)) {
echo 'Found';
}
else {
echo 'Not Found';
}
Returns 'Not Found' even though 'test' is a value in the array
$list = 'test
list
example';
$list_arr = array();
$list_arr = explode("\n",$list);
if (in_array('qwerty',$list_arr)) {
echo 'Found';
}
else {
echo 'Not Found';
}
Returns 'Not Found', as it should
Why is it returning false when it should be true? Please give any suggestions. The list I am actually using has more than 10K of values and therefore I just shortened it here.