3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = 'S1G5AB'; // given this $store = '5I6GAB'; // actually this $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) )); 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 = 24, Position 2 = 26
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bqtuA
function name:  (null)
number of ops:  29
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                                               'implode'
          3        SEND_VAL                                                 ''
          4        INIT_FCALL                                               'array_map'
    6     5        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FbqtuA%3A6%240'
   12     6        CAST                                          6  ~6      <array>
          7        CONCAT                                           ~7      ~5, ~6
          8        SEND_VAL                                                 ~7
          9        DO_ICALL                                         $8      
         10        SEND_VAR                                                 $8
         11        DO_ICALL                                         $9      
    5    12        ASSIGN                                                   !2, $9
   14    13        CONCAT                                           ~11     !2, '%0A'
         14        ECHO                                                     ~11
   15    15        INIT_FCALL                                               'preg_match'
         16        ROPE_INIT                                     3  ~13     '%2F'
         17        ROPE_ADD                                      1  ~13     ~13, !2
         18        ROPE_END                                      2  ~12     ~13, '%2F'
         19        SEND_VAL                                                 ~12
         20        SEND_VAR                                                 !1
         21        DO_ICALL                                         $15     
         22        IS_SMALLER                                               0, $15
         23      > JMPZ                                                     ~16, ->26
         24    >   QM_ASSIGN                                        ~17     'Match'
         25      > JMP                                                      ->27
         26    >   QM_ASSIGN                                        ~17     'No+match'
         27    >   ECHO                                                     ~17
         28      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FbqtuA%3A6%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bqtuA
function name:  {closure}
number of ops:  12
compiled vars:  !0 = $char, !1 = $map
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    7     1        ECHO                                                     !0
    8     2      > RETURN                                                   !0
    9     3*       BIND_STATIC                                              !1
   10     4*       ARRAY_KEY_EXISTS                                         !0, !1
          5*       JMPZ                                                     ~2, ->9
          6*       FETCH_DIM_R                                      ~3      !1, !0
          7*       QM_ASSIGN                                        ~4      ~3
          8*       JMP                                                      ->10
          9*       QM_ASSIGN                                        ~4      !0
         10*       RETURN                                                   ~4
   11    11*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FbqtuA%3A6%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.94 ms | 1392 KiB | 19 Q