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 5

I'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

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to