Re: SimpleXML: A bug or just an annoyance?
| From: | Stut | Date: | Mon, 13 Nov 2006 14:28:41 +0000 |
| Subject: | Re: SimpleXML: A bug or just an annoyance? | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-26540@lists.php.net to get a copy of this message | ||
Sebastian Bergmann wrote:
1 <?php 2 $root = simplexml_load_string('<root id="1"><node/></root>'); 3 4 $array = array(); 5 $array[$root['id']] = 'value'; 6 7 $key = (int)$root['id']; 8 $array[$key] = 'value'; 9 ?> Warning: Illegal offset type in /home/sb/test.php on line 5I've not used it much, but I believe you need to cast attributes coming out of SimpleXML, in this case probably to an int. -Stut