3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = 'S1G5AB'; // given this $store = '5I6GAB'; // actually this $regex = array_map(function ($x) { return $x; }, str_split($input)); /* $regex = implode('', array_map( function ($char) { echo $char; return $char; static $map = ['S'=>'[S5]','5'=>'[S5]','1'=>'[1I]','I'=>'[1I]','G'=>'[6G]','6'=>'[6G]']; return array_key_exists($char, $map) ? $map[$char] : $char; }. [ 'a', 'b' ] // str_split($input) )); */ var_dump($regex); echo $regex . PHP_EOL; echo (0 < preg_match("/$regex/", $store) ? 'Match' : 'No match');
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 27
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QqGJK
function name:  (null)
number of ops:  30
compiled vars:  !0 = $input, !1 = $store, !2 = $regex
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'S1G5AB'
    3     1        ASSIGN                                                   !1, '5I6GAB'
    5     2        INIT_FCALL                                               'array_map'
          3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FQqGJK%3A5%240'
          4        SEND_VAL                                                 ~5
          5        INIT_FCALL                                               'str_split'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $6      
          8        SEND_VAR                                                 $6
          9        DO_ICALL                                         $7      
         10        ASSIGN                                                   !2, $7
   17    11        INIT_FCALL                                               'var_dump'
         12        SEND_VAR                                                 !2
         13        DO_ICALL                                                 
   18    14        CONCAT                                           ~10     !2, '%0A'
         15        ECHO                                                     ~10
   19    16        INIT_FCALL                                               'preg_match'
         17        ROPE_INIT                                     3  ~12     '%2F'
         18        ROPE_ADD                                      1  ~12     ~12, !2
         19        ROPE_END                                      2  ~11     ~12, '%2F'
         20        SEND_VAL                                                 ~11
         21        SEND_VAR                                                 !1
         22        DO_ICALL                                         $14     
         23        IS_SMALLER                                               0, $14
         24      > JMPZ                                                     ~15, ->27
         25    >   QM_ASSIGN                                        ~16     'Match'
         26      > JMP                                                      ->28
         27    >   QM_ASSIGN                                        ~16     'No+match'
         28    >   ECHO                                                     ~16
         29      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FQqGJK%3A5%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QqGJK
function name:  {closure}
number of ops:  3
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1      > RETURN                                                   !0
          2*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FQqGJK%3A5%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.86 ms | 1396 KiB | 21 Q