3v4l.org

run code in 300+ PHP versions simultaneously
<?php function get_converted_url($full_url) { $urls_to_convert = ['/some/url/', '/other/url']; $parsed_url = parse_url($full_url); $path = $parsed_url['path']; foreach ($urls_to_convert as $url_to_convert) { if (strpos($path, $url_to_convert, 0) !== false) { return $url_to_convert; } } return $path; } echo get_converted_url('/test/some/url/') . "\n"; echo get_converted_url('/some/url/a/b/') . "\n"; echo get_converted_url('/other/url/a/b/') . "\n"; echo get_converted_url('/strange/url/a/b/') . "\n";
Output for git.master_jit, git.master, rfc.property-hooks
/some/url/ /some/url/ /other/url /strange/url/a/b/

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:
77.81 ms | 405 KiB | 5 Q