ID: 46306 Updated by: [EMAIL PROTECTED] Reported By: sunco007 at hotmail dot com -Status: Open +Status: Wont fix Bug Type: SimpleXML related Operating System: Vista Business PHP Version: 5.2.6 New Comment:
Due to the way simplexml works, you have to cast that to a string. Just write $malecon_link[(string) $datos->plaza] = $datos->url; and then it does what you expect Previous Comments: ------------------------------------------------------------------------ [2008-10-15 17:29:25] sunco007 at hotmail dot com Description: ------------ I create a Xml file and when i want to read some values it just return a blank value. I you do an echo to every value works fine, but when you put all togheter is when it fails The same if you read directly from a file or from a var (simplexml_load_file or simplexml_load_string) Reproduce code: --------------- <? $values = '<?xml version="1.0" encoding="ISO-8859-1" ?> <root> <nota> <url><![CDATA[opinion.php?id=16619&extra=m]]></url> <plaza>MZT</plaza> </nota> </root>'; $xml = simplexml_load_string($values); foreach ($xml->nota as $datos) { // work echo "-".$datos->plaza."-<br>"; // work echo "-".$datos->url."-<br>"; // put together $malecon_link[$datos->plaza] = $datos->url; // don't work echo "-".$malecon_link[$datos->plaza]."-<br>"; } ?> Expected result: ---------------- $malecon_link[$datos->plaza] must return the value, in this case the url Actual result: -------------- Return a blank value ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=46306&edit=1