3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [10,20,30,40,50,60,70]; $final_count = 3; $new_array = array_map(function ($a) { return array_sum($a) / count($a); }, array_chunk($array, (int)(count($array) / $final_count))); print_r($new_array);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vYu9g
function name:  (null)
number of ops:  19
compiled vars:  !0 = $array, !1 = $final_count, !2 = $new_array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, 3
    6     2        INIT_FCALL                                               'array_map'
          3        DECLARE_LAMBDA_FUNCTION                          ~5      [0]
    8     4        SEND_VAL                                                 ~5
          5        INIT_FCALL                                               'array_chunk'
          6        SEND_VAR                                                 !0
          7        COUNT                                            ~6      !0
          8        DIV                                              ~7      ~6, !1
          9        CAST                                          4  ~8      ~7
         10        SEND_VAL                                                 ~8
         11        DO_ICALL                                         $9      
         12        SEND_VAR                                                 $9
    6    13        DO_ICALL                                         $10     
         14        ASSIGN                                                   !2, $10
   10    15        INIT_FCALL                                               'print_r'
         16        SEND_VAR                                                 !2
         17        DO_ICALL                                                 
         18      > 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/vYu9g
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    7     1        INIT_FCALL                                               'array_sum'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $1      
          4        COUNT                                            ~2      !0
          5        DIV                                              ~3      $1, ~2
          6      > RETURN                                                   ~3
    8     7*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
127.79 ms | 1013 KiB | 17 Q