3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php echo "LIBXML_DOTTED_VERSION: " . LIBXML_DOTTED_VERSION . "\n\n"; $dom = new DOMDocument(); $dom->preserveWhiteSpace = true; $dom->formatOutput = false; $dom->loadHTML( "<!DOCTYPE html><html><head><meta charset=utf-8></head><body><ul><li>First</li><li>Second</li></ul></body></html>" ); echo "# \$dom->saveHTML( \$dom->documentElement ):\n"; $first = trim( $dom->saveHTML( $dom->documentElement ) ); echo $first; echo "\n"; echo "\n"; echo "# ~\$dom->saveHTML():\n"; $second = trim( str_replace( "<!DOCTYPE html>\n", "", $dom->saveHTML() ) ); echo $second; echo "\n\n"; echo $first === $second ? "PASS" : "FAIL";
Output for 5.4.0 - 5.6.30, 7.0.0 - 7.2.8
LIBXML_DOTTED_VERSION: 2.9.4 # $dom->saveHTML( $dom->documentElement ): <html> <head><meta charset="utf-8"></head> <body><ul> <li>First</li> <li>Second</li> </ul></body> </html> # ~$dom->saveHTML(): <html><head><meta charset="utf-8"></head><body><ul><li>First</li><li>Second</li></ul></body></html> FAIL
Output for 5.3.25 - 5.3.29, hhvm-3.10.1 - 3.22.0
LIBXML_DOTTED_VERSION: 2.9.1 # $dom->saveHTML( $dom->documentElement ): <html> <head><meta charset="utf-8"></head> <body><ul> <li>First</li> <li>Second</li> </ul></body> </html> # ~$dom->saveHTML(): <html><head><meta charset="utf-8"></head><body><ul><li>First</li><li>Second</li></ul></body></html> FAIL
Output for 5.3.15 - 5.3.24
LIBXML_DOTTED_VERSION: 2.8.0 # $dom->saveHTML( $dom->documentElement ): <html> <head><meta charset="utf-8"></head> <body><ul> <li>First</li> <li>Second</li> </ul></body> </html> # ~$dom->saveHTML(): <html><head><meta charset="utf-8"></head><body><ul><li>First</li><li>Second</li></ul></body></html> FAIL
Output for 5.3.6 - 5.3.14
LIBXML_DOTTED_VERSION: 2.7.8 # $dom->saveHTML( $dom->documentElement ): <html> <head><meta charset="utf-8"></head> <body><ul> <li>First</li> <li>Second</li> </ul></body> </html> # ~$dom->saveHTML(): <html><head><meta charset="utf-8"></head><body><ul><li>First</li><li>Second</li></ul></body></html> FAIL
Output for 5.3.3 - 5.3.5
LIBXML_DOTTED_VERSION: 2.7.8 # $dom->saveHTML( $dom->documentElement ): Warning: DOMDocument::saveHTML() expects exactly 0 parameters, 1 given in /in/77dc4 on line 10 # ~$dom->saveHTML(): <html><head><meta charset="utf-8"></head><body><ul><li>First</li><li>Second</li></ul></body></html> FAIL
Output for 5.1.0 - 5.3.2
LIBXML_DOTTED_VERSION: 2.7.8 # $dom->saveHTML( $dom->documentElement ): Warning: DOMDocument::saveHTML() expects exactly 0 parameters, 1 given in /in/77dc4 on line 10 # ~$dom->saveHTML(): <html> <head><meta charset="utf-8"></head> <body><ul> <li>First</li> <li>Second</li> </ul></body> </html> FAIL
Output for 5.0.0 - 5.0.5
Notice: Use of undefined constant LIBXML_DOTTED_VERSION - assumed 'LIBXML_DOTTED_VERSION' in /in/77dc4 on line 2 LIBXML_DOTTED_VERSION: LIBXML_DOTTED_VERSION # $dom->saveHTML( $dom->documentElement ): Warning: DOMDocument::saveHTML() expects exactly 0 parameters, 1 given in /in/77dc4 on line 10 # ~$dom->saveHTML(): <html> <head><meta charset="utf-8"></head> <body><ul> <li>First</li> <li>Second</li> </ul></body> </html> FAIL
Output for 4.3.2 - 4.4.9
Notice: Use of undefined constant LIBXML_DOTTED_VERSION - assumed 'LIBXML_DOTTED_VERSION' in /in/77dc4 on line 2 LIBXML_DOTTED_VERSION: LIBXML_DOTTED_VERSION Fatal error: Cannot instantiate non-existent class: domdocument in /in/77dc4 on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Notice: Use of undefined constant LIBXML_DOTTED_VERSION - assumed 'LIBXML_DOTTED_VERSION' in /in/77dc4 on line 2 LIBXML_DOTTED_VERSION: LIBXML_DOTTED_VERSION Fatal error: Cannot instantiate non-existent class: domdocument in /in/77dc4 on line 4