3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = ['one', 'two', 'free']; $value = 10; $arr = array_reverse($arr); Foreach($arr as $key => $val){ if($key==0){ $new[$val]= $value; }else{ $new = [$val => $new]; } } var_dump($new);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 17
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 17
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 14
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/VRJOY
function name:  (null)
number of ops:  22
compiled vars:  !0 = $arr, !1 = $value, !2 = $val, !3 = $key, !4 = $new
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, 10
    6     2        INIT_FCALL                                               'array_reverse'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $7      
          5        ASSIGN                                                   !0, $7
    8     6      > FE_RESET_R                                       $9      !0, ->17
          7    > > FE_FETCH_R                                       ~10     $9, !2, ->17
          8    >   ASSIGN                                                   !3, ~10
    9     9        IS_EQUAL                                                 !3, 0
         10      > JMPZ                                                     ~12, ->14
   10    11    >   ASSIGN_DIM                                               !4, !2
         12        OP_DATA                                                  !1
         13      > JMP                                                      ->16
   12    14    >   INIT_ARRAY                                       ~14     !4, !2
         15        ASSIGN                                                   !4, ~14
    8    16    > > JMP                                                      ->7
         17    >   FE_FREE                                                  $9
   16    18        INIT_FCALL                                               'var_dump'
         19        SEND_VAR                                                 !4
         20        DO_ICALL                                                 
         21      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
186.75 ms | 1400 KiB | 17 Q