note 74615 added to function.simplexml-load-string

From: Date: Fri, 20 Apr 2007 09:27:18 +0000
Subject: note 74615 added to function.simplexml-load-string
Groups: php.notes 
Request: Send a blank email to php-notes+get-125607@lists.php.net to get a copy of this message
$string = '<root id="1"> <images amount="3"> <image width="800" height="600">1.jpg</image> <image width="800" height="600">2.jpg</image> <image width="600" height="800">3.jpg</image> </images> </root>'; print_r(simplexml_load_string($string)); In the example above it returns: SimpleXMLElement Object ( [@attributes] => Array ( [id] => 1 ) [images] => SimpleXMLElement Object ( [@attributes] => Array ( [amount] => 3 ) [image] => Array ( [0] => 1.jpg [1] => 2.jpg [2] => 3.jpg ) ) ) But where are my width and height? Why issn't it posible to read out attributes of a node that has a value? But you can read out a node that has a sub node why is that? ---- Server IP: 194.109.193.76 Probable Submitter: 217.194.107.215 ---- Manual Page -- http://www.php.net/manual/en/function.simplexml-load-string.php Edit -- https://master.php.net/note/edit/74615 Del: integrated -- https://master.php.net/note/delete/74615/integrated Del: useless -- https://master.php.net/note/delete/74615/useless Del: bad code -- https://master.php.net/note/delete/74615/bad+code Del: spam -- https://master.php.net/note/delete/74615/spam Del: non-english -- https://master.php.net/note/delete/74615/non-english Del: in docs -- https://master.php.net/note/delete/74615/in+docs Del: other reasons-- https://master.php.net/note/delete/74615 Reject -- https://master.php.net/note/reject/74615 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#125607) next »