Annotation of embedaddon/php/ext/simplexml/tests/029.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: SimpleXML: foreach and count
! 3: --SKIPIF--
! 4: <?php if (!extension_loaded("simplexml")) print "skip"; ?>
! 5: --FILE--
! 6: <?php
! 7: $xml =<<<EOF
! 8: <people>
! 9: <person name="Joe"/>
! 10: <person name="John">
! 11: <children>
! 12: <person name="Joe"/>
! 13: </children>
! 14: </person>
! 15: <person name="Jane"/>
! 16: </people>
! 17: EOF;
! 18:
! 19: $people = simplexml_load_string($xml);
! 20:
! 21: foreach($people as $person)
! 22: {
! 23: var_dump((string)$person['name']);
! 24: var_dump(count($people));
! 25: var_dump(count($person));
! 26: }
! 27:
! 28: ?>
! 29: ===DONE===
! 30: --EXPECTF--
! 31: string(3) "Joe"
! 32: int(3)
! 33: int(0)
! 34: string(4) "John"
! 35: int(3)
! 36: int(1)
! 37: string(4) "Jane"
! 38: int(3)
! 39: int(0)
! 40: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>