3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = "111000111111"; //preg_match_all('/(.)\1*/', $str, $match); $digits = str_split($str, 4); $replace = array("1110" => "A", "0011" => "B", "1111" => "C"); Foreach($digits as $val){ Echo $replace[$val]; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 12
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 12
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
filename:       /in/QfQQ8
function name:  (null)
number of ops:  14
compiled vars:  !0 = $str, !1 = $digits, !2 = $replace, !3 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '111000111111'
    5     1        INIT_FCALL                                               'str_split'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 4
          4        DO_ICALL                                         $5      
          5        ASSIGN                                                   !1, $5
    6     6        ASSIGN                                                   !2, <array>
    8     7      > FE_RESET_R                                       $8      !1, ->12
          8    > > FE_FETCH_R                                               $8, !3, ->12
    9     9    >   FETCH_DIM_R                                      ~9      !2, !3
         10        ECHO                                                     ~9
    8    11      > JMP                                                      ->8
         12    >   FE_FREE                                                  $8
   10    13      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
244.69 ms | 999 KiB | 14 Q