3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xml = '<html> <head> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="Pragma" content="no-cache"> </head> <body> <img src="http://chart.googleapis.com/chart?chs=280x160&amp;chd=t:0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,69,90,109,233,449,376,379,525,492,571,775,828,573,533,548,874,1575,3493,4167,3814,4925,5378,5304,5757,3420,3202,2557,2765,2424,1607,1763,2846,6531,3921,4434,5906,6411,5120,7219,6526,4060,6951,7261,5942,2946,6788,7190,6827,7361,5476,6776,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0&amp;cht=lc&amp;chds=0,8100&amp;chxr=0,6,20,2|1,0,8100&amp;chtt=29.03.2016+11:25:06&amp;chdlp=bv&amp;chm=B,FF0000,0,0,0&amp;chco=FF0000"> <br> <table border="0" width="280"> <tbody> <tr> <td valign="top">Tag:</td> <td align="right" valign="top">14.5</td> <td align="right" valign="top">kWh</td> <td align="right" valign="top">Monat:</td> <td align="right" valign="top">690</td> <td align="right" valign="top">kWh</td> </tr> <tr> <td valign="top">Jahr:</td> <td align="right" valign="top">1375</td> <td align="right" valign="top">kWh</td> <td align="right" valign="top">Gesamt:</td> <td align="right" valign="top">39482</td> <td align="right" valign="top">kWh</td> </tr> <tr> <td valign="top">PAC:</td> <td align="right">6776</td> <td>W</td> </tr> </tbody> </table> </body> </html> '; $doc = new DOMDocument(); $doc->loadHTML($xml); $sxml = simplexml_import_dom($doc); print_r($sxml);
Output for 5.1.2 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.30, 7.0.0 - 7.0.23, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.16, 7.3.18 - 7.3.33, 7.4.0 - 7.4.4, 7.4.6 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
SimpleXMLElement Object ( [head] => SimpleXMLElement Object ( [meta] => Array ( [0] => SimpleXMLElement Object ( [@attributes] => Array ( [http-equiv] => cache-control [content] => no-cache ) ) [1] => SimpleXMLElement Object ( [@attributes] => Array ( [http-equiv] => expires [content] => 0 ) ) [2] => SimpleXMLElement Object ( [@attributes] => Array ( [http-equiv] => Pragma [content] => no-cache ) ) ) ) [body] => SimpleXMLElement Object ( [img] => SimpleXMLElement Object ( [@attributes] => Array ( [src] => http://chart.googleapis.com/chart?chs=280x160&chd=t:0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,69,90,109,233,449,376,379,525,492,571,775,828,573,533,548,874,1575,3493,4167,3814,4925,5378,5304,5757,3420,3202,2557,2765,2424,1607,1763,2846,6531,3921,4434,5906,6411,5120,7219,6526,4060,6951,7261,5942,2946,6788,7190,6827,7361,5476,6776,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0&cht=lc&chds=0,8100&chxr=0,6,20,2|1,0,8100&chtt=29.03.2016+11:25:06&chdlp=bv&chm=B,FF0000,0,0,0&chco=FF0000 ) ) [br] => SimpleXMLElement Object ( ) [table] => SimpleXMLElement Object ( [@attributes] => Array ( [border] => 0 [width] => 280 ) [tbody] => SimpleXMLElement Object ( [tr] => Array ( [0] => SimpleXMLElement Object ( [td] => Array ( [0] => Tag: [1] => 14.5 [2] => kWh [3] => Monat: [4] => 690 [5] => kWh ) ) [1] => SimpleXMLElement Object ( [td] => Array ( [0] => Jahr: [1] => 1375 [2] => kWh [3] => Gesamt: [4] => 39482 [5] => kWh ) ) [2] => SimpleXMLElement Object ( [td] => Array ( [0] => PAC: [1] => 6776 [2] => W ) ) ) ) ) ) )
Output for 7.3.17, 7.4.5
SimpleXMLElement Object ( [head] => SimpleXMLElement Object ( [meta] => Array ( [0] => SimpleXMLElement Object ( [@attributes] => Array ( [http-equiv] => cache-control [content] => no-cache ) ) [1] => SimpleXMLElement Object ( [@attributes] => Array ( [http-equiv] => expires [content] => 0 ) ) [2] => SimpleXMLElement Object ( [@attributes] => Array ( [http-equiv] => Pragma [content] => no-cache ) ) ) ) [body] => SimpleXMLElement Object ( [img] => SimpleXMLElement Object ( [@attributes] => Array ( [src] => http://chart.googleapis.com/chart?chs=280x160&chd=t:0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,69,90,109,233,449,376,379,525,492,571,775,828,573,533,548,874,1575,3493,4167,3814,4925,5378,5304,5757,3420,3202,2557,2765,2424,1607,1763,2846,6531,3921,4434,5906,6411,5120,7219,6526,4060,6951,7261,5942,2946,6788,7190,6827,7361,5476,6776,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0&cht=lc&chds=0,8100&chxr=0,6,20,2|1,0,8100&chtt=29.03.2016+11:25:06&chdlp=bv&chm=B,FF0000,0,0,0&chco=FF0000 ) ) [br] => SimpleXMLElement Object ( ) [table] => SimpleXMLElement Object ( [@attributes] => Array ( [border] => 0 [width] => 280 ) [tbody] => SimpleXMLElement Object ( [tr] => Array ( [0] => SimpleXMLElement Object ( [td] => Array ( [0] => SimpleXMLElement Object ( [@attributes] => Array ( [valign] => top ) [0] => Tag: ) [1] => SimpleXMLElement Object ( [@attributes] => Array ( [align] => right [valign] => top ) [0] => 14.5 ) [2] => SimpleXMLElement Object ( [@attributes] => Array ( [align] => right [valign] => top ) [0] => kWh ) [3] => SimpleXMLElement Object ( [@attributes] => Array ( [align] => right [valign] => top ) [0] => Monat: ) [4] => SimpleXMLElement Object ( [@attributes] => Array ( [align] => right [valign] => top ) [0] => 690 ) [5] => SimpleXMLElement Object ( [@attributes] => Array ( [align] => right [valign] => top ) [0] => kWh ) ) ) [1] => SimpleXMLElement Object ( [td] => Array ( [0] => SimpleXMLElement Object ( [@attributes] => Array ( [valign] => top ) [0] => Jahr: ) [1] => SimpleXMLElement Object ( [@attributes] => Array ( [align] => right [valign] => top ) [0] => 1375 ) [2] => SimpleXMLElement Object ( [@attributes] => Array ( [align] => right [valign] => top ) [0] => kWh ) [3] => SimpleXMLElement Object ( [@attributes] => Array ( [align] => right [valign] => top ) [0] => Gesamt: ) [4] => SimpleXMLElement Object ( [@attributes] => Array ( [align] => right [valign] => top ) [0] => 39482 ) [5] => SimpleXMLElement Object ( [@attributes] => Array ( [align] => right [valign] => top ) [0] => kWh ) ) ) [2] => SimpleXMLElement Object ( [td] => Array ( [0] => SimpleXMLElement Object ( [@attributes] => Array ( [valign] => top ) [0] => PAC: ) [1] => SimpleXMLElement Object ( [@attributes] => Array ( [align] => right ) [0] => 6776 ) [2] => W ) ) ) ) ) ) )
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.1
SimpleXMLElement Object ( [head] => SimpleXMLElement Object ( [meta] => Array ( [0] => SimpleXMLElement Object ( ) [1] => SimpleXMLElement Object ( ) [2] => SimpleXMLElement Object ( ) ) ) [body] => SimpleXMLElement Object ( [img] => SimpleXMLElement Object ( ) [br] => SimpleXMLElement Object ( ) [table] => SimpleXMLElement Object ( [tbody] => SimpleXMLElement Object ( [tr] => Array ( [0] => SimpleXMLElement Object ( [td] => Array ( [0] => Tag: [1] => 14.5 [2] => kWh [3] => Monat: [4] => 690 [5] => kWh ) ) [1] => SimpleXMLElement Object ( [td] => Array ( [0] => Jahr: [1] => 1375 [2] => kWh [3] => Gesamt: [4] => 39482 [5] => kWh ) ) [2] => SimpleXMLElement Object ( [td] => Array ( [0] => PAC: [1] => 6776 [2] => W ) ) ) ) ) ) )
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.9
Fatal error: Cannot instantiate non-existent class: domdocument in /in/dWQau on line 40
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: domdocument in /in/dWQau on line 40

preferences:
331.34 ms | 401 KiB | 404 Q