3v4l.org

run code in 300+ PHP versions simultaneously
<?php $stringRegex = "/([aA][0-9]+)/"; $schema = [ 'a26UserId', 'a17Passwd', 'cAccountChannel', 'a256PcInfo1' ]; $result = []; foreach ($schema as $currentType) { if (preg_match($stringRegex, $currentType, $matches)) { $result[] = $matches[1]; } else { $result[] = substr($currentType, 0, 1); } } print_r($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 23
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 23
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 15
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
filename:       /in/qin19
function name:  (null)
number of ops:  28
compiled vars:  !0 = $stringRegex, !1 = $schema, !2 = $result, !3 = $currentType, !4 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%2F%28%5BaA%5D%5B0-9%5D%2B%29%2F'
    4     1        ASSIGN                                                   !1, <array>
   11     2        ASSIGN                                                   !2, <array>
   13     3      > FE_RESET_R                                       $8      !1, ->23
          4    > > FE_FETCH_R                                               $8, !3, ->23
   14     5    >   INIT_FCALL                                               'preg_match'
          6        SEND_VAR                                                 !0
          7        SEND_VAR                                                 !3
          8        SEND_REF                                                 !4
          9        DO_ICALL                                         $9      
         10      > JMPZ                                                     $9, ->15
   15    11    >   FETCH_DIM_R                                      ~11     !4, 1
         12        ASSIGN_DIM                                               !2
         13        OP_DATA                                                  ~11
         14      > JMP                                                      ->22
   17    15    >   INIT_FCALL                                               'substr'
         16        SEND_VAR                                                 !3
         17        SEND_VAL                                                 0
         18        SEND_VAL                                                 1
         19        DO_ICALL                                         $13     
         20        ASSIGN_DIM                                               !2
         21        OP_DATA                                                  $13
   13    22    > > JMP                                                      ->4
         23    >   FE_FREE                                                  $8
   21    24        INIT_FCALL                                               'print_r'
         25        SEND_VAR                                                 !2
         26        DO_ICALL                                                 
         27      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.42 ms | 1396 KiB | 19 Q