foreach ($pElements as $pElement) { var_dump($pElement); } If I execute the above, I notice it dumps each value in the 'nodes' array even though $pElement is an object. Can anyone explain this behavior?
At first I thought running foreach on an object automatically searches for a member array, but the first listed array namespaces seems to be ignored.
Here is the full object $pElements:
/var/www/html/phpTestArea/index.php:35: object(Symfony\Component\DomCrawler\Crawler)[38] protected 'uri' => null private 'defaultNamespacePrefix' => string 'default' (length=7) private 'namespaces' => array (size=0) empty private 'baseHref' => null private 'document' => object(DOMDocument)[2] public 'doctype' => string '(object value omitted)' (length=22) public 'implementation' => string '(object value omitted)' (length=22) <public properties removed> private 'nodes' => array (size=2) 0 => object(DOMElement)[36] <public properties removed> 1 => object(DOMElement)[35] <public properties removed> private 'isHtml' => boolean true