3v4l.org

run code in 300+ PHP versions simultaneously
<?PHP $paths = [ '.*/cars$', '^cars/.*/', '/trucks$', '.*/trucks$' ]; $url = 'some-site.com/cars'; foreach($paths AS $v) { if (preg_match('~'.$v.'~', $url, $out)) { echo $v.' matched this part of $url: '.$out[0]; break; } } ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 18
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 18
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 17
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 18
Branch analysis from position: 18
filename:       /in/B5A98
function name:  (null)
number of ops:  20
compiled vars:  !0 = $paths, !1 = $url, !2 = $v, !3 = $out
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   10     1        ASSIGN                                                   !1, 'some-site.com%2Fcars'
   12     2      > FE_RESET_R                                       $6      !0, ->18
          3    > > FE_FETCH_R                                               $6, !2, ->18
   13     4    >   INIT_FCALL                                               'preg_match'
          5        CONCAT                                           ~7      '%7E', !2
          6        CONCAT                                           ~8      ~7, '%7E'
          7        SEND_VAL                                                 ~8
          8        SEND_VAR                                                 !1
          9        SEND_REF                                                 !3
         10        DO_ICALL                                         $9      
         11      > JMPZ                                                     $9, ->17
   14    12    >   CONCAT                                           ~10     !2, '+matched+this+part+of+%24url%3A+'
         13        FETCH_DIM_R                                      ~11     !3, 0
         14        CONCAT                                           ~12     ~10, ~11
         15        ECHO                                                     ~12
         16      > JMP                                                      ->18
   12    17    > > JMP                                                      ->3
         18    >   FE_FREE                                                  $6
   19    19      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
136.47 ms | 1437 KiB | 14 Q