-2

I have a SimpleXMLElement like this:

SimpleXMLElement Object ( [trailer] => SimpleXMLElement Object (
[title] => This is the title
[link] => http://example.com
[trailer_id] => 60373
[embed] => SimpleXMLElement Object ( ) ) )

I've google for two hours now, and couldn't find how to print the "trailer_id". Could anybody point me in the right direction?

hakre
  • 193,403
  • 52
  • 435
  • 836
3und80
  • 364
  • 6
  • 20
  • 1
    Interesting what text you used while searching this. – Leri Oct 05 '12 at 13:44
  • Would you mind posting the original XML? – Explosion Pills Oct 05 '12 at 13:44
  • Two hours? `:o)`. Just found [this](http://stackoverflow.com/questions/1133931/getting-actual-value-from-php-simplexml-node), which looks very helpful. – halfer Oct 05 '12 at 13:46
  • 1
    seems like i just used the wrong key words for about two hours.. :P – 3und80 Oct 05 '12 at 13:59
  • 1
    seems like you should have started with http://php.net/manual/en/simplexml.examples-basic.php – Gordon Oct 05 '12 at 14:26
  • possible duplicate of [Forcing a SimpleXML Object to a string, regardless of context](http://stackoverflow.com/questions/416548/forcing-a-simplexml-object-to-a-string-regardless-of-context) – hakre Oct 05 '12 at 14:31

1 Answers1

1

They are objects, try:

echo $xml->trailer->trailer_id;
Mihai Iorga
  • 39,330
  • 16
  • 106
  • 107