note 49771 added to ref.simplexml

From: Date: Tue, 08 Feb 2005 10:24:45 +0000
Subject: note 49771 added to ref.simplexml
Groups: php.notes 
Request: Send a blank email to php-notes+get-84658@lists.php.net to get a copy of this message
Just a quick note - if you wish to get the name of the tag you are operating on, use the the key bit of foreach, i.e in the example: <?php // Outputs title characters plot rating rating foreach($xml->movie[0]->children() as $tag => $child){ echo $tag; } ?> This might seem obvious but it stumped me for a bit. ---- Manual Page -- http://www.php.net/manual/en/ref.simplexml.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+49771 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+49771&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+49771&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+49771&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+49771&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+49771&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+49771&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#84658) next »