3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = 'S1G5AB'; // given this $store = '5I6GAB'; // actually this $regex = array_map('trim', 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 = 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/VJfiA
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                                               'array_map'
          3        SEND_VAL                                                 'trim'
          4        INIT_FCALL                                               'str_split'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $5      
          7        SEND_VAR                                                 $5
          8        DO_ICALL                                         $6      
          9        ASSIGN                                                   !2, $6
   17    10        INIT_FCALL                                               'var_dump'
         11        SEND_VAR                                                 !2
         12        DO_ICALL                                                 
   18    13        CONCAT                                           ~9      !2, '%0A'
         14        ECHO                                                     ~9
   19    15        INIT_FCALL                                               'preg_match'
         16        ROPE_INIT                                     3  ~11     '%2F'
         17        ROPE_ADD                                      1  ~11     ~11, !2
         18        ROPE_END                                      2  ~10     ~11, '%2F'
         19        SEND_VAL                                                 ~10
         20        SEND_VAR                                                 !1
         21        DO_ICALL                                         $13     
         22        IS_SMALLER                                               0, $13
         23      > JMPZ                                                     ~14, ->26
         24    >   QM_ASSIGN                                        ~15     'Match'
         25      > JMP                                                      ->27
         26    >   QM_ASSIGN                                        ~15     'No+match'
         27    >   ECHO                                                     ~15
         28      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.23 ms | 1395 KiB | 21 Q