toggle Cinema 19 Sep 2008

Parseando xml con php. Posted by Insane in Php | No responses

$s='<items>

 <item id="2"></item>

 <item id="3"></item>

 <item id="4"></item>

 <item id="5"></item>

 <item id="6" attr="self"></item>

</items>';
$items=aray();

$xml = simplexml_load_string($s);

foreach($xml as $item):

  $attrs = (object)$item->attributes();

  echo "id = ".$attrs->id." & "." attr = ".@$attrs->attr."\n";

endforeach;
  • Share/Bookmark

Tags: ,

Promote this post

Would you like to add this post to your bookmarks? Come on, do not miss any updates and stay tuned.
Please share with us!

This entry no have comments but you can be first .

Leave a Reply ( Guest )

(*)

(will not be published) (*)