3v4l.org

run code in 300+ PHP versions simultaneously
<?php $expr = '! ^ (?: (?P<scheme> [a-z][a-z0-9.]* ) : )? (?: // (?<authority> (?: (?P<user> [^:@]+ ) (?: : (?P<pass> [^@]+ ) )? @ )? (?P<host> [^:/]+ ) (?: : (?P<port> [0-9]+ ) )? ) )? (?: / (?P<path> /[^?#]+ ) )? (?: \? (?P<query> [^#]+ ) )? (?: # (?P<fragment> .+ ) )? $ !ix'; $urls = [ 'http://host.com/path', 'http://user@host.com/path', 'http://user:pass@host.com/path', 'http://user:pass@host.com:8080/path', '//user:pass@host.com:8080/path', 'http://user:pass@host.com:8080/path?query#fragment', ]; foreach ($urls as $str) { echo "$str\n"; preg_match($expr, $str, $matches); var_dump($matches); }
Output for git.master, git.master_jit, rfc.property-hooks
http://host.com/path array(19) { [0]=> string(20) "http://host.com/path" ["scheme"]=> string(4) "http" [1]=> string(4) "http" ["authority"]=> string(8) "host.com" [2]=> string(8) "host.com" ["user"]=> string(0) "" [3]=> string(0) "" ["pass"]=> string(0) "" [4]=> string(0) "" ["host"]=> string(8) "host.com" [5]=> string(8) "host.com" ["port"]=> string(0) "" [6]=> string(0) "" ["path"]=> string(0) "" [7]=> string(0) "" ["query"]=> string(0) "" [8]=> string(0) "" ["fragment"]=> string(5) "/path" [9]=> string(5) "/path" } http://user@host.com/path array(19) { [0]=> string(25) "http://user@host.com/path" ["scheme"]=> string(4) "http" [1]=> string(4) "http" ["authority"]=> string(13) "user@host.com" [2]=> string(13) "user@host.com" ["user"]=> string(4) "user" [3]=> string(4) "user" ["pass"]=> string(0) "" [4]=> string(0) "" ["host"]=> string(8) "host.com" [5]=> string(8) "host.com" ["port"]=> string(0) "" [6]=> string(0) "" ["path"]=> string(0) "" [7]=> string(0) "" ["query"]=> string(0) "" [8]=> string(0) "" ["fragment"]=> string(5) "/path" [9]=> string(5) "/path" } http://user:pass@host.com/path array(19) { [0]=> string(30) "http://user:pass@host.com/path" ["scheme"]=> string(4) "http" [1]=> string(4) "http" ["authority"]=> string(18) "user:pass@host.com" [2]=> string(18) "user:pass@host.com" ["user"]=> string(4) "user" [3]=> string(4) "user" ["pass"]=> string(4) "pass" [4]=> string(4) "pass" ["host"]=> string(8) "host.com" [5]=> string(8) "host.com" ["port"]=> string(0) "" [6]=> string(0) "" ["path"]=> string(0) "" [7]=> string(0) "" ["query"]=> string(0) "" [8]=> string(0) "" ["fragment"]=> string(5) "/path" [9]=> string(5) "/path" } http://user:pass@host.com:8080/path array(19) { [0]=> string(35) "http://user:pass@host.com:8080/path" ["scheme"]=> string(4) "http" [1]=> string(4) "http" ["authority"]=> string(23) "user:pass@host.com:8080" [2]=> string(23) "user:pass@host.com:8080" ["user"]=> string(4) "user" [3]=> string(4) "user" ["pass"]=> string(4) "pass" [4]=> string(4) "pass" ["host"]=> string(8) "host.com" [5]=> string(8) "host.com" ["port"]=> string(4) "8080" [6]=> string(4) "8080" ["path"]=> string(0) "" [7]=> string(0) "" ["query"]=> string(0) "" [8]=> string(0) "" ["fragment"]=> string(5) "/path" [9]=> string(5) "/path" } //user:pass@host.com:8080/path array(19) { [0]=> string(30) "//user:pass@host.com:8080/path" ["scheme"]=> string(0) "" [1]=> string(0) "" ["authority"]=> string(23) "user:pass@host.com:8080" [2]=> string(23) "user:pass@host.com:8080" ["user"]=> string(4) "user" [3]=> string(4) "user" ["pass"]=> string(4) "pass" [4]=> string(4) "pass" ["host"]=> string(8) "host.com" [5]=> string(8) "host.com" ["port"]=> string(4) "8080" [6]=> string(4) "8080" ["path"]=> string(0) "" [7]=> string(0) "" ["query"]=> string(0) "" [8]=> string(0) "" ["fragment"]=> string(5) "/path" [9]=> string(5) "/path" } http://user:pass@host.com:8080/path?query#fragment array(19) { [0]=> string(50) "http://user:pass@host.com:8080/path?query#fragment" ["scheme"]=> string(4) "http" [1]=> string(4) "http" ["authority"]=> string(23) "user:pass@host.com:8080" [2]=> string(23) "user:pass@host.com:8080" ["user"]=> string(4) "user" [3]=> string(4) "user" ["pass"]=> string(4) "pass" [4]=> string(4) "pass" ["host"]=> string(8) "host.com" [5]=> string(8) "host.com" ["port"]=> string(4) "8080" [6]=> string(4) "8080" ["path"]=> string(0) "" [7]=> string(0) "" ["query"]=> string(0) "" [8]=> string(0) "" ["fragment"]=> string(20) "/path?query#fragment" [9]=> string(20) "/path?query#fragment" }

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:
44.15 ms | 409 KiB | 8 Q