3v4l.org

run code in 300+ PHP versions simultaneously
<?php function cluster($array) { $array = array_reverse($array); foreach($array as $element) { $newarray = [$element=>$newarray]; } return $newarray; } var_dump(cluster(['A', 'B', 'C', 'D','E','F','G','H','I']));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OIqvH
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'cluster'
          2        SEND_VAL                                                 <array>
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
          5        DO_ICALL                                                 
          6      > RETURN                                                   1

Function cluster:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 10
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 10
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/OIqvH
function name:  cluster
number of ops:  13
compiled vars:  !0 = $array, !1 = $element, !2 = $newarray
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        INIT_FCALL                                               'array_reverse'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $3      
          4        ASSIGN                                                   !0, $3
    4     5      > FE_RESET_R                                       $5      !0, ->10
          6    > > FE_FETCH_R                                               $5, !1, ->10
    5     7    >   INIT_ARRAY                                       ~6      !2, !1
          8        ASSIGN                                                   !2, ~6
    4     9      > JMP                                                      ->6
         10    >   FE_FREE                                                  $5
    7    11      > RETURN                                                   !2
    8    12*     > RETURN                                                   null

End of function cluster

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.84 ms | 1398 KiB | 18 Q