3v4l.org

run code in 300+ PHP versions simultaneously
<?php $regex_url = <<<REGEX ` (?(DEFINE) (?<slash_seg> /(?&pchar)* ) (?<pchar> [a-zA-Z\d\-._~!$&'()*+,;=:@%]* ) (?<queryfrag> [a-zA-Z\d\-._~!$&'()*+,;=:@%/?]* ) ) ^ (?: (?<scheme> [a-zA-Z][a-zA-Z\d+\-.]* ) :)? (?: (?: // (?: (?<userinfo> (?<user> [a-zA-Z\d\-._~!$&'()*+,;=%]*) (?: :(?<pass> [a-zA-Z\d\-._~!$&'()*+,;=%:]*) )? ) @)? (?<host> (?<host_name> [a-zA-Z\d\-\.%]+ ) | (?<ipv4> \d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} ) | (?: \[ (?<ipv6> [a-fA-F\d.:]+ ) \] ) ) (?: :(?<port> \d*) )? ) (?<path> (?: /(?&pchar)* )* ) | (?<path_abs> /(?: (?&pchar)+ (?&slash_seg)* )? ) | (?<path_rel> (?&pchar)+ (?&slash_seg)* ) )? (?: \? (?<query> (?&queryfrag) ) )? (?: \# (?<fragment> (?&queryfrag) ) )? `x REGEX; $urls = [ 'scheme://username:password@domain:443/path?query_string#fragment_id', 'http://en.wikipedia.org/wiki/URI#Examples_of_URI_references', 'http://127.0.0.1/ipv4', 'http://[db8:0cec::99:123a]/ipv6', 'http://example.org/absolute/URI/with/absolute/path/to/resource.txt', '//example.org/scheme-relative/URI/with/absolute/path/to/resource.txt', '/relative/URI/with/absolute/path/to/resource.txt', 'relative/path/to/resource.txt', '../../../resource.txt', './resource.txt#frag01', 'resource.txt', '#frag01', '', ]; foreach($urls as $url) { preg_match($regex_url, $url, $m); var_dump($m); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 13
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 13
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/4So3Z
function name:  (null)
number of ops:  15
compiled vars:  !0 = $regex_url, !1 = $urls, !2 = $url, !3 = $m
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%60%0A%09%28%3F%28DEFINE%29%0A%09%09%28%3F%3Cslash_seg%3E+%2F%28%3F%26pchar%29%2A+%29%0A%09%09%28%3F%3Cpchar%3E+%5Ba-zA-Z%5Cd%5C-._%7E%21%24%26%27%28%29%2A%2B%2C%3B%3D%3A%40%25%5D%2A+%29%0A%09%09%28%3F%3Cqueryfrag%3E+%5Ba-zA-Z%5Cd%5C-._%7E%21%24%26%27%28%29%2A%2B%2C%3B%3D%3A%40%25%2F%3F%5D%2A+%29%0A%09%29%0A%5E%0A%09%28%3F%3A+%28%3F%3Cscheme%3E+%5Ba-zA-Z%5D%5Ba-zA-Z%5Cd%2B%5C-.%5D%2A+%29+%3A%29%3F+%0A%09%28%3F%3A%0A%09%09%28%3F%3A+%2F%2F%0A%09%09%09%28%3F%3A+%28%3F%3Cuserinfo%3E%0A%09%09%09%09%28%3F%3Cuser%3E+%5Ba-zA-Z%5Cd%5C-._%7E%21%24%26%27%28%29%2A%2B%2C%3B%3D%25%5D%2A%29%0A%09%09%09%09%28%3F%3A+%3A%28%3F%3Cpass%3E+%5Ba-zA-Z%5Cd%5C-._%7E%21%24%26%27%28%29%2A%2B%2C%3B%3D%25%3A%5D%2A%29+%29%3F%0A%09%09%09%29+%40%29%3F%0A%09%09%09%28%3F%3Chost%3E%0A%09%09%09%09%28%3F%3Chost_name%3E+%5Ba-zA-Z%5Cd%5C-%5C.%25%5D%2B+%29%0A%09%09%09%09%7C%0A%09%09%09%09%28%3F%3Cipv4%3E+%5Cd%7B1%2C3%7D%5C.%5Cd%7B1%2C3%7D%5C.%5Cd%7B1%2C3%7D%5C.%5Cd%7B1%2C3%7D+%29%0A%09%09%09%09%7C%0A%09%09%09%09%28%3F%3A+%5C%5B+%28%3F%3Cipv6%3E+%5Ba-fA-F%5Cd.%3A%5D%2B+%29+%5C%5D+%29%0A%09%09%09%29%0A%09%09%09%28%3F%3A+%3A%28%3F%3Cport%3E+%5Cd%2A%29+%29%3F%0A%09%09%29%0A%09%09%28%3F%3Cpath%3E+%28%3F%3A+%2F%28%3F%26pchar%29%2A+%29%2A+%29%0A%09%09%7C%0A%09%09%28%3F%3Cpath_abs%3E+%2F%28%3F%3A+%28%3F%26pchar%29%2B+%28%3F%26slash_seg%29%2A+%29%3F+%29%0A%09%09%7C%0A%09%09%28%3F%3Cpath_rel%3E+%28%3F%26pchar%29%2B+%28%3F%26slash_seg%29%2A+%29%0A%09%29%3F%0A%09%28%3F%3A+%5C%3F+%28%3F%3Cquery%3E+%28%3F%26queryfrag%29+%29+%29%3F%0A%09%28%3F%3A+%5C%23+%28%3F%3Cfragment%3E+%28%3F%26queryfrag%29+%29+%29%3F%0A%60x'
   39     1        ASSIGN                                                   !1, <array>
   55     2      > FE_RESET_R                                       $6      !1, ->13
          3    > > FE_FETCH_R                                               $6, !2, ->13
   56     4    >   INIT_FCALL                                               'preg_match'
          5        SEND_VAR                                                 !0
          6        SEND_VAR                                                 !2
          7        SEND_REF                                                 !3
          8        DO_ICALL                                                 
   57     9        INIT_FCALL                                               'var_dump'
         10        SEND_VAR                                                 !3
         11        DO_ICALL                                                 
   55    12      > JMP                                                      ->3
         13    >   FE_FREE                                                  $6
   58    14      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.31 ms | 1396 KiB | 17 Q