3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); $string = <<<'EOF' Bar <meta content="text/html; charset=unicode" http-equiv="Content-Type"> Foo EOF; libxml_use_internal_errors(true); $dom = new DOMDocument(); $dom->loadHTML($string); $f = $dom->saveHTML(); echo $f . PHP_EOL . PHP_EOL; $weirdStuff = preg_match('/>([\&\#a-zA-Z0-9\;]+)</', $f, $result); echo $result[1] . PHP_EOL . PHP_EOL; $utf8 = mb_convert_encoding($result[1], 'UTF-8', 'HTML-ENTITIES'); echo $utf8 . PHP_EOL . PHP_EOL; echo iconv('UTF-8', 'unicode', $utf8) . PHP_EOL . PHP_EOL;
Output for git.master, git.master_jit, rfc.property-hooks
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <html><body><p>Bar <meta content="text/html; charset=unicode" http-equiv="Content-Type">&#15882;&dagger;&#8262;&#28527;</p></body></html> &#15882;&dagger;&#8262;&#28527; 㸊†⁆潯 Warning: iconv(): Wrong encoding, conversion from "UTF-8" to "unicode" is not allowed in /in/kJ0tV on line 22

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
27.8 ms | 406 KiB | 5 Q