Guest User

Untitled

a guest
Jul 21st, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. ## test.php
  2. <?php
  3. $xml = new SimpleXMLElement(file_get_contents('test.xml'));
  4.  
  5. foreach ($xml->movie as $movie) {
  6. echo $movie->plot . "\r\n";
  7. }
  8.  
  9. ## test.xml[plain_text]
  10. <movies>
  11. <movie>
  12. <title>PHP: Behind the Parser</title>
  13. <characters>
  14. <character>
  15. <name>Ms. Coder</name>
  16. <actor>Onlivia Actora</actor>
  17. </character>
  18. <character>
  19. <name>Mr. Coder</name>
  20. <actor>El Act&#211;r</actor>
  21. </character>
  22. </characters>
  23. <plot>
  24. So, this language. It's like, a programming language. Or is it a
  25. scripting language? All is revealed in this thrilling horror spoof
  26. of a documentary.
  27. </plot>
  28. <great-lines>
  29. <line>PHP solves all my web problems</line>
  30. </great-lines>
  31. <rating type="thumbs">7</rating>
  32. <rating type="stars">5</rating>
  33. </movie>
  34. </movies>
  35.  
  36. ## Run command [plain_text]
  37. -bash-3.2$ php test.php
  38.  
  39. So, this language. It's like, a programming language. Or is it a
  40. scripting language? All is revealed in this thrilling horror spoof
  41. of a documentary.
Add Comment
Please, Sign In to add comment