3v4l.org

run code in 300+ PHP versions simultaneously
<?php header('Content-Type: text/html; charset=UTF-8'); $str = "<h1>He'llü & Wor&#39;ldÆØÅÅÅ!</h1>" . "\tcafé\n"; if ('UTF-8' !== mb_detect_encoding($str)) { $str = utf8_encode($str); } var_dump($str); $str = html_entity_decode($str, ENT_QUOTES | ENT_XML1, 'UTF-8'); var_dump($str); $str = filter_var(html_entity_decode($str, ENT_QUOTES | ENT_XML1, 'UTF-8'), FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH | FILTER_FLAG_NO_ENCODE_QUOTES); var_dump($str); #$newstr = preg_replace('/\s[\s]+/', ' ', $str); // Strip off multiple spaces $newstr = preg_replace('/[^\000-\128]+/', '', $str); // Strip off non-alpha-numeric #$newstr = preg_replace('/[\s\W]+/', '-', $newstr); // Strip off spaces and non-alpha-numeric #$newstr = preg_replace('/[^A-Za-z0-9_-]+/', '', $newstr); var_dump($newstr);
Output for git.master, git.master_jit, rfc.property-hooks
string(47) "<h1>He'llü & Wor&#39;ldÆØÅÅÅ!</h1> café " string(43) "<h1>He'llü & Wor'ldÆØÅÅÅ!</h1> café " Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /in/mbs0r on line 14 string(18) "He'll & Wor'ld!caf" string(0) ""

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:
59.02 ms | 402 KiB | 8 Q