3v4l.org

run code in 300+ PHP versions simultaneously
<?php function array_group($array, $callable) { $result = array(); foreach ($array as $key => $value) { $key = $callable($key, $value); if (!isset($result[$key])) { $result[$key] = array(); } $result[$key][] = $value; } return $result; } $arr = range(1,10); var_dump(array_group($arr, function($key, $value) { return intval($value % 2); }));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dulMm
function name:  (null)
number of ops:  14
compiled vars:  !0 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   INIT_FCALL                                               'range'
          1        SEND_VAL                                                 1
          2        SEND_VAL                                                 10
          3        DO_ICALL                                         $1      
          4        ASSIGN                                                   !0, $1
   17     5        INIT_FCALL                                               'var_dump'
          6        INIT_FCALL                                               'array_group'
          7        SEND_VAR                                                 !0
          8        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FdulMm%3A17%240'
          9        SEND_VAL                                                 ~3
         10        DO_FCALL                                      0  $4      
         11        SEND_VAR                                                 $4
         12        DO_ICALL                                                 
         13      > RETURN                                                   1

Function array_group:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 20
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 20
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 16
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 16
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
filename:       /in/dulMm
function name:  array_group
number of ops:  23
compiled vars:  !0 = $array, !1 = $callable, !2 = $result, !3 = $value, !4 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2        ASSIGN                                                   !2, <array>
    5     3      > FE_RESET_R                                       $6      !0, ->20
          4    > > FE_FETCH_R                                       ~7      $6, !3, ->20
          5    >   ASSIGN                                                   !4, ~7
    6     6        INIT_DYNAMIC_CALL                                        !1
          7        SEND_VAR_EX                                              !4
          8        SEND_VAR_EX                                              !3
          9        DO_FCALL                                      0  $9      
         10        ASSIGN                                                   !4, $9
    7    11        ISSET_ISEMPTY_DIM_OBJ                         0  ~11     !2, !4
         12        BOOL_NOT                                         ~12     ~11
         13      > JMPZ                                                     ~12, ->16
    8    14    >   ASSIGN_DIM                                               !2, !4
         15        OP_DATA                                                  <array>
   10    16    >   FETCH_DIM_W                                      $14     !2, !4
         17        ASSIGN_DIM                                               $14
         18        OP_DATA                                                  !3
    5    19      > JMP                                                      ->4
         20    >   FE_FREE                                                  $6
   12    21      > RETURN                                                   !2
   13    22*     > RETURN                                                   null

End of function array_group

Function %00%7Bclosure%7D%2Fin%2FdulMm%3A17%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dulMm
function name:  {closure}
number of ops:  6
compiled vars:  !0 = $key, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        MOD                                              ~2      !1, 2
          3        CAST                                          4  ~3      ~2
          4      > RETURN                                                   ~3
          5*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FdulMm%3A17%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.44 ms | 1403 KiB | 18 Q