3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = []; $lastChar = null; foreach (str_split('10001101') as $char) { if ($char !== $lastChar) { unset($ref); $array[] = &$ref; $ref = $char; $lastChar = $char; } else { $ref .= $char; } } var_export($array);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 17
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 17
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 15
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/Jp9Sk
function name:  (null)
number of ops:  22
compiled vars:  !0 = $array, !1 = $lastChar, !2 = $char, !3 = $ref
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, null
    5     2        INIT_FCALL                                               'str_split'
          3        SEND_VAL                                                 '10001101'
          4        DO_ICALL                                         $6      
          5      > FE_RESET_R                                       $7      $6, ->17
          6    > > FE_FETCH_R                                               $7, !2, ->17
    6     7    >   IS_NOT_IDENTICAL                                         !2, !1
          8      > JMPZ                                                     ~8, ->15
    7     9    >   UNSET_CV                                                 !3
    8    10        FETCH_DIM_W                                      $9      !0
         11        ASSIGN_REF                                               $9, !3
    9    12        ASSIGN                                                   !3, !2
   10    13        ASSIGN                                                   !1, !2
         14      > JMP                                                      ->16
   12    15    >   ASSIGN_OP                                     8          !3, !2
    5    16    > > JMP                                                      ->6
         17    >   FE_FREE                                                  $7
   15    18        INIT_FCALL                                               'var_export'
         19        SEND_VAR                                                 !0
         20        DO_ICALL                                                 
         21      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
192.25 ms | 1395 KiB | 17 Q