3v4l.org

run code in 300+ PHP versions simultaneously
<?php function format_url($url) { if(parse_url($url, PHP_URL_SCHEME) === null) { $url = 'http://' . $url; //parse_url() requires scheme to parse URL correctly } $parsed_url = parse_url($url); $formatted_url = get_domain($parsed_url['host'], false); if (isset($parsed_url['path'])) { $formatted_url .= $parsed_url['path']; } if (isset($parsed_url['query'])) { $formatted_url .= '?' . $parsed_url['query']; } $formatted_url = rtrim($formatted_url, '/'); return $formatted_url; } $url = 'http://www.igrushka-spb.ru/index.php?categoryID=1718'; var_dump(format_url($url));
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Error: Call to undefined function get_domain() in /in/JV7RU:10 Stack trace: #0 /in/JV7RU(27): format_url('http://www.igru...') #1 {main} thrown in /in/JV7RU on line 10
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:
86.92 ms | 401 KiB | 8 Q