xml load - PHP Online

Form of PHP Sandbox

Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php in the places where the PHP script should be executed.



Your result can be seen below.

Result of php executing





Full code of xml load.php

  1. <?php
  2.         //Enter your code here, enjoy!
  3.  
  4. $txt = '<field name="User">';
  5. $txt .= '<option value="First"/>';
  6. $txt .= '<option value="Sercondary">';
  7. $txt .= '<option value="Thirty"/>';
  8. $txt .= '</option>';
  9. $txt .= '</field>';
  10.  
  11. $xml = simplexml_load_string($txt);
  12.  
  13. $xml = $xml->xpath('option');
  14.  
  15. var_dump($xml);
File Description
  • xml load
  • PHP Code
  • 24 Jan-2022
  • 311 Bytes
You can Share it: