3v4l.org

run code in 300+ PHP versions simultaneously
<?php $urls = [ 'https://example.com/api/', 'https://www.example.com/test-subpath', 'https://www.example.com', 'example.com/test/page', 'www.example.com', 'www.subdomain.example.com', 'https://www.subdomain.example.com', 'subdomain.example.com', 'http://subdomain.example.com', 'https://subdomain.example.com', ]; function checkUrl(string $url): bool { return (bool)filter_var($url, FILTER_VALIDATE_URL); } foreach ($urls as $url) { if (checkUrl($url)) { echo $url . ' is a valid URL' . PHP_EOL; continue; } $urlWithProtocol = 'https://' . $url; if (checkUrl($urlWithProtocol)) { echo $urlWithProtocol . ' with added protocol is a valid URL' . PHP_EOL; continue; } echo $url . ' is not a valid URL' . PHP_EOL; }
Output for git.master_jit, git.master, rfc.property-hooks
https://example.com/api/ is a valid URL https://www.example.com/test-subpath is a valid URL https://www.example.com is a valid URL https://example.com/test/page with added protocol is a valid URL https://www.example.com with added protocol is a valid URL https://www.subdomain.example.com with added protocol is a valid URL https://www.subdomain.example.com is a valid URL https://subdomain.example.com with added protocol is a valid URL http://subdomain.example.com is a valid URL https://subdomain.example.com is a valid URL

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:
48.85 ms | 407 KiB | 5 Q