3v4l.org

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.4 ms | 1395 KiB | 19 Q