|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-10-11 20:11 UTC] iliaa@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 23:00:01 2025 UTC |
Description: ------------ is_array() does not work on member arrays of SimpleXMLElement objects. Reproduce code: --------------- <?php $foo = simplexml_load_string( '<?xml version="1.0" encoding="iso-8859-1" ?> <foo> <bar> <barbara>barbara</barbara> </bar> <bar> <barbara>barbara</barbara> <barbara>barbara</barbara> </bar> </foo>'); foreach ($foo->bar as $bar) { var_dump(is_array($bar->barbara)); var_dump($bar); } ?> Expected result: ---------------- bool(false) object(SimpleXMLElement)#4 (1) { ["barbara"]=> string(7) "barbara" } bool(true) object(SimpleXMLElement)#5 (1) { ["barbara"]=> array(2) { [0]=> string(7) "barbara" [1]=> string(7) "barbara" } } Actual result: -------------- bool(false) object(SimpleXMLElement)#4 (1) { ["barbara"]=> string(7) "barbara" } bool(false) object(SimpleXMLElement)#5 (1) { ["barbara"]=> array(2) { [0]=> string(7) "barbara" [1]=> string(7) "barbara" } }