What am I doing wrong in the code below?
print_r(array_values($haystack));
returns the following:
Array ( [0] => Array ( [name] => album2 ) [1] => Array ( [name] => album3 ) [2] => Array ( [name] => Album 1 ) [3] => Array ( [name] => jopie99 ) [4] => Array ( [name] => kopie3 ) [5] => Array ( [name] => test56 ) [6] => Array ( [name] => rob7 ) ) testArray ( [0] => Array ( [name] => album2 ) [1] => Array ( [name] => album3 ) [2] => Array ( [name] => Album 1 ) [3] => Array ( [name] => jopie99 ) [4] => Array ( [name] => kopie3 ) [5] => Array ( [name] => test56 ) [6] => Array ( [name] => rob7 ) )
Now I have the following code:
$needle = 'album3';
if (in_array($needle, $haystack)) {
//do something
}
At least the needle can be found somewhere in the haystack, but apparently not with the if statement given. Can someone help me out?