3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * Format URL * * @param $url * @return string */ function format_url($url) { $parsed_url = parse_url($url); $host = get_domain($parsed_url['host'], false); $path = preg_replace('#index\.[a-z]+#', '', $parsed_url['path']); $url = $host . $path; if (isset($parsed_url['query'])) { $url .= '?' . $parsed_url['query']; } return rtrim($url, '/'); } /** * Compare two formatted urls * * @param string $url_1 * @param string $url_2 * @return bool */ function compare_urls($url_1, $url_2) { return format_url($url_1) === format_url($url_2); } $url_1 = 'http://seos.bolseo.ru/index.php?module=2&siteID=235'; $url_2 = 'seos.bolseo.ru/?module=2&siteID=235'; var_dump(compare_urls($url_1, $url_2));
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Error: Call to undefined function get_domain() in /in/fK6SH:12 Stack trace: #0 /in/fK6SH(32): format_url('http://seos.bol...') #1 /in/fK6SH(38): compare_urls('http://seos.bol...', 'seos.bolseo.ru/...') #2 {main} thrown in /in/fK6SH on line 12
Process exited with code 255.

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:
47.91 ms | 401 KiB | 8 Q