I need to iterate over two sets of arrays and if they match or do not match then they need to be styled different.
A quick working example is:
$animal1 = array('elephant', 'giraffe', 'lion');
$animal2 = array('elephant', 'giraffe', 'cow');
$animal3 = array('elephant', 'lion', 'giraffe');
foreach($animal1 as $animal) {
echo $animal . " ";
if(in_array($animal, $animal2, true)) {
echo "yay<br />";
}
else {
echo "no<br />";
}
}
The problem is my that my arrays actually contain objects instead of just data. When I var_dump($example) I'll get something like the following:
array (size=1)
0 =>
object(stdClass)[200]
public 'id' => int 3
public 'c_name' => string 'AFAM-202-001-2015Spring' (length=23)
public 'c_avail' => string 'Y' (length=1)
1 =>
object(stdClass)[201]
public 'id' => int 4
public 'c_name' => string 'IDES-203-001-2015Spring' (length=23)
public 'c_avail' => string 'Y' (length=1)
So working my $example array into the first example doesn't work. Anyone have any ideas how I can do this? Apparently in_object doesn't exist in PHP ...