fork download
  1. <?php
  2.  
  3. // your code goes here
  4.  
  5. $xml = <<<XML
  6.  
  7. <EXPORT-RECORDS>
  8.   <PRODUCT>
  9.   <PRODUCTS_NAME>Panasonic Super Heavy Duty Battery AA - 4 Pack</PRODUCTS_NAME>
  10.   <PRODUCTS_DESCRIPTION>Batteries keep going and going and going until they don\'t. And there\'s nothing more disappointing than </PRODUCTS_DESCRIPTION>
  11. </PRODUCT>
  12.   <PRODUCT>
  13.   <PRODUCTS_NAME>Panasonic Super Heavy Duty Battery AA - 4 Pack</PRODUCTS_NAME>
  14. <PRODUCTS_DESCRIPTION>Batteries keep going and going and going until they don\'t. And there\'s nothing more disappointing than</PRODUCTS_DESCRIPTION>
  15. </PRODUCT>
  16. </EXPORT-RECORDS>
  17. XML;
  18.  
  19. $xml = simplexml_load_string($xml);
  20.  
  21. foreach($xml->PRODUCT as $PRODUCT){
  22. echo $PRODUCT->PRODUCTS_NAME;
  23. }
Success #stdin #stdout 0.01s 24400KB
stdin
Standard input is empty
stdout
Panasonic Super Heavy Duty Battery AA - 4 PackPanasonic Super Heavy Duty Battery AA - 4 Pack