3v4l.org

run code in 500+ PHP versions simultaneously
<?php $data = [[ "continent" => "Europa", "country" => "France", "capital" => "Paris", ],[ "continent" => "Europa", "country" => "Spain", "capital" => "Madrid", ],[ "continent" => "Asia", "country" => "Russia", "capital" => "Moscow", ]]; $groupByContinent = function(array $list) { return array_reduce($list, function($grouped, $item) { $grouped[$item['continent']][] = $item; return $grouped; }, []); }; $groupedByContinent = $groupByContinent($data); var_dump($groupedByContinent);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/s6X1c
function name:  (null)
number of ops:  11
compiled vars:  !0 = $data, !1 = $groupByContinent, !2 = $groupedByContinent
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   17     1        DECLARE_LAMBDA_FUNCTION                              ~4      [0]
          2        ASSIGN                                                       !1, ~4
   24     3        INIT_DYNAMIC_CALL                                            !1
          4        SEND_VAR_EX                                                  !0
          5        DO_FCALL                                          0  $6      
          6        ASSIGN                                                       !2, $6
   26     7        INIT_FCALL                                                   'var_dump'
          8        SEND_VAR                                                     !2
          9        DO_ICALL                                                     
         10      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/s6X1c
function name:  {closure:/in/s6X1c:17}
number of ops:  9
compiled vars:  !0 = $list
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   17     0  E >   RECV                                                 !0      
   18     1        INIT_FCALL                                                   'array_reduce'
          2        SEND_VAR                                                     !0
          3        DECLARE_LAMBDA_FUNCTION                              ~1      [0]
   21     4        SEND_VAL                                                     ~1
          5        SEND_VAL                                                     <array>
   18     6        DO_ICALL                                             $2      
   21     7      > RETURN                                                       $2
   22     8*     > RETURN                                                       null


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/s6X1c
function name:  {closure:{closure:/in/s6X1c:17}:18}
number of ops:  8
compiled vars:  !0 = $grouped, !1 = $item
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   18     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
   19     2        FETCH_DIM_R                                          ~2      !1, 'continent'
          3        FETCH_DIM_W                                          $3      !0, ~2
          4        ASSIGN_DIM                                                   $3
          5        OP_DATA                                                      !1
   20     6      > RETURN                                                       !0
   21     7*     > RETURN                                                       null

End of Dynamic Function 0

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
223.24 ms | 2149 KiB | 15 Q