3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = '123ABC5678'; $User_input = "2.3-2-2.1"; preg_match_all("/(.)/", $User_input, $pattern); $i=0; $str=""; foreach($pattern[1] as $val){ if(is_numeric($val)){ $str .= substr($string,$i,$val); $i=$i+$val; }else{ $str .= $val; //$i=$i+1; } } echo $str;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 27
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 27
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 25
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
filename:       /in/5eg5G
function name:  (null)
number of ops:  30
compiled vars:  !0 = $string, !1 = $User_input, !2 = $pattern, !3 = $i, !4 = $str, !5 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '123ABC5678'
    3     1        ASSIGN                                                   !1, '2.3-2-2.1'
    5     2        INIT_FCALL                                               'preg_match_all'
          3        SEND_VAL                                                 '%2F%28.%29%2F'
          4        SEND_VAR                                                 !1
          5        SEND_REF                                                 !2
          6        DO_ICALL                                                 
    7     7        ASSIGN                                                   !3, 0
    8     8        ASSIGN                                                   !4, ''
    9     9        FETCH_DIM_R                                      ~11     !2, 1
         10      > FE_RESET_R                                       $12     ~11, ->27
         11    > > FE_FETCH_R                                               $12, !5, ->27
   11    12    >   INIT_FCALL                                               'is_numeric'
         13        SEND_VAR                                                 !5
         14        DO_ICALL                                         $13     
         15      > JMPZ                                                     $13, ->25
   12    16    >   INIT_FCALL                                               'substr'
         17        SEND_VAR                                                 !0
         18        SEND_VAR                                                 !3
         19        SEND_VAR                                                 !5
         20        DO_ICALL                                         $14     
         21        ASSIGN_OP                                     8          !4, $14
   13    22        ADD                                              ~16     !3, !5
         23        ASSIGN                                                   !3, ~16
   11    24      > JMP                                                      ->26
   15    25    >   ASSIGN_OP                                     8          !4, !5
    9    26    > > JMP                                                      ->11
         27    >   FE_FREE                                                  $12
   22    28        ECHO                                                     !4
         29      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.08 ms | 1013 KiB | 16 Q