|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2017-11-27 11:21 UTC] thisnicknamewasfree at gmail dot com
Description: ------------ PHP 7.0+ supports both arrays and array of objects for array_column, However it's not true for array of Traversable objects and looks like a bug. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 21:00:01 2025 UTC |
<?php $dom = new \DomDocument; $dom->loadHTML('<span>ONE</span><span>TWO</span>'); $xpath = new \DomXPath($dom); # $xpath -> \DOMXPath $nodes = $xpath->query('//span'); # $nodes -> \DOMNodeList # this works: foreach ($nodes as $node) { echo $node->nodeValue; # \DOMElement } # this not: array_column($nodes, 'nodeValue'); ?>