fork download
  1. <?php
  2.  
  3.  
  4. $xml = '<?xml version="1.0" encoding="UTF-8"?><nome>Wallace</nome>';
  5.  
  6. $xml_errado = ' ' . $xml;
  7.  
  8. // Certo
  9.  
  10.  
  11. // Errado
  12.  
  13. // Com supŕessor
  14.  
  15.  
  16. // Com "trim"
Success #stdin #stdout #stderr 0.02s 52472KB
stdin
Standard input is empty
stdout
object(SimpleXMLElement)#1 (1) {
  [0]=>
  string(7) "Wallace"
}
bool(false)
bool(false)
object(SimpleXMLElement)#1 (1) {
  [0]=>
  string(7) "Wallace"
}
stderr
PHP Warning:  simplexml_load_string(): Entity: line 1: parser error : XML declaration allowed only at the start of the document in /home/IVqxWl/prog.php on line 13
PHP Warning:  simplexml_load_string():  <?xml version="1.0" encoding="UTF-8"?><nome>Wallace</nome> in /home/IVqxWl/prog.php on line 13
PHP Warning:  simplexml_load_string():       ^ in /home/IVqxWl/prog.php on line 13