3v4l.org

run code in 300+ PHP versions simultaneously
<?php function a($strUrl) { $strUrl = explode('/', $strUrl, 4); $strUrl[3] = rawurlencode($strUrl[3]); $strUrl[3] = str_replace(array('%2F', '%3F', '%3D', '%26', '%25'), array('/', '?', '=', '&', '%'), $strUrl[3]); $strUrl = implode('/', $strUrl); $strUrl = str_replace('&', '&amp;', $strUrl); return $strUrl; } function b($strUrl) { return htmlspecialchars($strUrl, ENT_XML1, 'UTF-8'); } $urls = array( 'http://www.example.com/', 'http://www.example.com/alias', 'http://www.example.com/alias.html', 'http://www.example.com/alias/page?foo=bar', 'http://www.example.com/alias?foo=bar&bar=foo', 'http://www.example.com:8080/alias', 'http://www.example.com:8080/alias?foo=bar&bar[bar]=foo', 'http://www.example.com/älias', ); foreach ($urls as $url) { if (a($url) === b($url)) { echo "✓\n"; echo $url."\n"; } else { echo "✘\n"; echo $url."\n"; echo a($url)."\n"; echo b($url)."\n"; } echo "\n"; }
Output for git.master, git.master_jit, rfc.property-hooks
✓ http://www.example.com/ ✓ http://www.example.com/alias ✓ http://www.example.com/alias.html ✓ http://www.example.com/alias/page?foo=bar ✓ http://www.example.com/alias?foo=bar&bar=foo ✓ http://www.example.com:8080/alias ✘ http://www.example.com:8080/alias?foo=bar&bar[bar]=foo http://www.example.com:8080/alias?foo=bar&amp;bar%5Bbar%5D=foo http://www.example.com:8080/alias?foo=bar&amp;bar[bar]=foo ✘ http://www.example.com/älias http://www.example.com/%C3%A4lias http://www.example.com/älias

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