Simple one here, but hurting ones head.
echo in_array('275', $searchMe);
is returning false. But if I print the array out and then search it manually using my web browser I am able to see that the value exists in the array.
[0] => ExtrasInfoType Object
(
[Criteria] =>
[Code] => 275
[Type] => 15
[Name] => Pen
)
Extra information. The array has been coverted from an object to an array using
$searchMe = (array) $object;
Would it be because the values are not quoted? I have tried using the following with the in_array function:
echo in_array('275', $searchMe); // returns false
echo in_array(275, $searchMe); // returns error (Notice: Object of class Extras could not be converted to int in)
var_dump of $searchMe
array
'Extras' =>
object(Extras)[6]
public 'Extra' =>
array
0 =>
object(ExtrasInfoType)[7]
...
1 =>
object(ExtrasInfoType)[17]
...
2 =>
object(ExtrasInfoType)[27]
...
$searchMeis still an object.in_array(), funnily enough, works on arrays :). You can however cast objects to arrays to turn their property/values into an associative array.