3v4l.org

run code in 300+ PHP versions simultaneously
<?php function array_group(callable $eq, array $xs) { $groupedXs = []; $grouped = [$xs[0]]; if ($eq($xs[0], $xs[1])) { $grouped[] = $xs[1]; } else { $groupedXs = $grouped; $grouped = [$xs[1]]; } } var_dump(array_group(function ($a, $b) { }, [[1, 'sold'], [2, 'registered'], [3, 'sold']]));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ujv8Z
function name:  (null)
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'array_group'
          2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fujv8Z%3A15%240'
   16     3        SEND_VAL                                                 ~0
          4        SEND_VAL                                                 <array>
          5        DO_FCALL                                      0  $1      
          6        SEND_VAR                                                 $1
          7        DO_ICALL                                                 
          8      > RETURN                                                   1

Function array_group:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 19
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ujv8Z
function name:  array_group
number of ops:  24
compiled vars:  !0 = $eq, !1 = $xs, !2 = $groupedXs, !3 = $grouped
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2        ASSIGN                                                   !2, <array>
    5     3        FETCH_DIM_R                                      ~5      !1, 0
          4        INIT_ARRAY                                       ~6      ~5
          5        ASSIGN                                                   !3, ~6
    7     6        INIT_DYNAMIC_CALL                                        !0
          7        CHECK_FUNC_ARG                                           
          8        FETCH_DIM_FUNC_ARG                               $8      !1, 0
          9        SEND_FUNC_ARG                                            $8
         10        CHECK_FUNC_ARG                                           
         11        FETCH_DIM_FUNC_ARG                               $9      !1, 1
         12        SEND_FUNC_ARG                                            $9
         13        DO_FCALL                                      0  $10     
         14      > JMPZ                                                     $10, ->19
    8    15    >   FETCH_DIM_R                                      ~12     !1, 1
         16        ASSIGN_DIM                                               !3
         17        OP_DATA                                                  ~12
         18      > JMP                                                      ->23
   10    19    >   ASSIGN                                                   !2, !3
   11    20        FETCH_DIM_R                                      ~14     !1, 1
         21        INIT_ARRAY                                       ~15     ~14
         22        ASSIGN                                                   !3, ~15
   13    23    > > RETURN                                                   null

End of function array_group

Function %00%7Bclosure%7D%2Fin%2Fujv8Z%3A15%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ujv8Z
function name:  {closure}
number of ops:  3
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   16     2      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Fujv8Z%3A15%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.48 ms | 1403 KiB | 16 Q