Next Nov 4 Previous
Digesting messages
Consider the following script:
<?php $str = <<<DATA <?xml version="1.0" encoding="UTF-8"?> <message> <from>Marc</from> <to>Judy</to> <body>Yes, I've tweeted it too!</body> </message> DATA; ... ?>
What goes at the dots if we need to print the message body?
A: echo simplexml_load_string($str)->body;
B: echo simplexml_load_string($str)->message->body;
C: echo simplexml_load($str)->message->body;
D: echo simplexml_load_data($str)->body;