3v4l.org

run code in 300+ PHP versions simultaneously
<?php function dumpMatches(string $regex, string $value): void { echo $regex . "\n"; if (preg_match($regex, $value, $matches) !== 1) { echo "no match\n"; } else { var_dump($matches); } echo "\n"; } dumpMatches('~a\Kb~', 'ab'); dumpMatches('~a\Kb~', 'b'); dumpMatches('~(a)\Kb~', 'ab'); dumpMatches('~(a\K)b~', 'ab');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PcEOS
function name:  (null)
number of ops:  17
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   INIT_FCALL                                               'dumpmatches'
          1        SEND_VAL                                                 '%7Ea%5CKb%7E'
          2        SEND_VAL                                                 'ab'
          3        DO_FCALL                                      0          
   14     4        INIT_FCALL                                               'dumpmatches'
          5        SEND_VAL                                                 '%7Ea%5CKb%7E'
          6        SEND_VAL                                                 'b'
          7        DO_FCALL                                      0          
   16     8        INIT_FCALL                                               'dumpmatches'
          9        SEND_VAL                                                 '%7E%28a%29%5CKb%7E'
         10        SEND_VAL                                                 'ab'
         11        DO_FCALL                                      0          
   17    12        INIT_FCALL                                               'dumpmatches'
         13        SEND_VAL                                                 '%7E%28a%5CK%29b%7E'
         14        SEND_VAL                                                 'ab'
         15        DO_FCALL                                      0          
         16      > RETURN                                                   1

Function dumpmatches:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 13
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PcEOS
function name:  dumpMatches
number of ops:  18
compiled vars:  !0 = $regex, !1 = $value, !2 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2        CONCAT                                           ~3      !0, '%0A'
          3        ECHO                                                     ~3
    5     4        INIT_FCALL                                               'preg_match'
          5        SEND_VAR                                                 !0
          6        SEND_VAR                                                 !1
          7        SEND_REF                                                 !2
          8        DO_ICALL                                         $4      
          9        IS_NOT_IDENTICAL                                         $4, 1
         10      > JMPZ                                                     ~5, ->13
    6    11    >   ECHO                                                     'no+match%0A'
    5    12      > JMP                                                      ->16
    8    13    >   INIT_FCALL                                               'var_dump'
         14        SEND_VAR                                                 !2
         15        DO_ICALL                                                 
   10    16    >   ECHO                                                     '%0A'
   11    17      > RETURN                                                   null

End of function dumpmatches

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.31 ms | 1014 KiB | 19 Q