I know how to check for a value in an array, but how do I check for a value in an Array Iterator?
$array = new ArrayIterator(array(
'1QmRjtsw2UQ' => array('pubdate' => '26 Jun 15', 'alt' => '8 Year Old Beautifully Covers Thinking Out Loud', 'anchor text' => '8-yo \'Thinking Out Loud\''),
'eKqLaYrcf3A' => array('pubdate' => '25 Jun 15', 'alt' => 'Plane Lands On Truck', 'anchor text' => 'Plane Lands On Truck'),
));
I'm trying to check for the values such as 1QmRjtsw2UQ
.
This does not work:
if(in_array('1QmRjtsw2UQ', $array));
why don't you use array_key_exists ?
if(array_key_exists('1QmRjtsw2UQ', $array))
{
// do something
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With