I have vardumped my array which comes out as this: array(2) { [0]=> object(stdClass) #308 (5) { ["iId"]=> int(8) ["sName"]=> string(14) "Portable Audio" ["iParentId"]=> int(4) ["sDescription"]=> string(14) "Portable Audio" ["bAdult"]=> bool(false) } [1]=> object(stdClass) #309 (5) { ["iId"]=> int(9) ["sName"]=> string(11) "Televisions" ["iParentId"]=> int(4) ["sDescription"]=> string(11) "Televisions" ["bAdult"]=> bool(false) } } Code (markup): What I am basically trying to do is just display the sNames and I have the following code: foreach ($array as $value) { if (isset($value->sName)) { echo $value->sName; } } PHP: It doesnt seem to work though Can anybody help?
Interesting situation. Try this: foreach ($array as &$value) { if (isset($value->sName)) { echo $value->sName; } } PHP: