Annotation of embedaddon/php/ext/simplexml/tests/022.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: SimpleXML: Attributes inside foreach
! 3: --SKIPIF--
! 4: <?php if (!extension_loaded("simplexml")) print "skip"; ?>
! 5: --FILE--
! 6: <?php
! 7:
! 8: $xml =<<<EOF
! 9: <?xml version='1.0'?>
! 10: <pres><content><file glob="slide_*.xml"/></content></pres>
! 11: EOF;
! 12:
! 13: $sxe = simplexml_load_string($xml);
! 14:
! 15: echo "===CONTENT===\n";
! 16: var_dump($sxe->content);
! 17:
! 18: echo "===FILE===\n";
! 19: var_dump($sxe->content->file);
! 20:
! 21: echo "===FOREACH===\n";
! 22: foreach($sxe->content->file as $file)
! 23: {
! 24: var_dump($file);
! 25: var_dump($file['glob']);
! 26: }
! 27:
! 28: ?>
! 29: ===DONE===
! 30: --EXPECTF--
! 31: ===CONTENT===
! 32: object(SimpleXMLElement)#%d (1) {
! 33: ["file"]=>
! 34: object(SimpleXMLElement)#%d (1) {
! 35: ["@attributes"]=>
! 36: array(1) {
! 37: ["glob"]=>
! 38: string(11) "slide_*.xml"
! 39: }
! 40: }
! 41: }
! 42: ===FILE===
! 43: object(SimpleXMLElement)#%d (1) {
! 44: ["@attributes"]=>
! 45: array(1) {
! 46: ["glob"]=>
! 47: string(11) "slide_*.xml"
! 48: }
! 49: }
! 50: ===FOREACH===
! 51: object(SimpleXMLElement)#%d (1) {
! 52: ["@attributes"]=>
! 53: array(1) {
! 54: ["glob"]=>
! 55: string(11) "slide_*.xml"
! 56: }
! 57: }
! 58: object(SimpleXMLElement)#%d (1) {
! 59: [0]=>
! 60: string(11) "slide_*.xml"
! 61: }
! 62: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>