3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array=Array ( "21" => Array ( "0" => 3.5, "65" => Array ( "0" => 44.125 ), "150" => Array ( "0" => 15.25 ), "151" => Array ( "0" => 17.333333333333 ) ), "23" => Array ( "0" => 0, "166" => Array ( "0" => 26 ), "172" => Array ( "0" =>0 ), "182" => Array ( "0" => 20.333333333333 ), "183" => Array ( "0" => 24.125 ) ) ); $count1 = 0; $sum=0; $count2 = 0; $sum2=0; function isarr($array,$key7,$sum1,$count) { $array2 = array_values($array); $size = sizeof($array2); foreach($array as $key1 => $value1) { if(is_array($value1)) { isarr($value1,$key7,$sum1,$count); } else { if($key1 == "0") { $sum1 = $sum1 + $value1;$count1++; } } } $array[$key7][0] = $sum1 / $count; } foreach ($array as $key3 => $value3) { isarr($value3,$key3,0,0); } //$array[21][0] = ($sum/$count1); //$array[23][0] = ($sum2/$count2); //echo $catCount = count(preg_grep("/^0+$/", array_keys(get_object_vars($array)))); print_r($array);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 15
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 15
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/U7OoZ
function name:  (null)
number of ops:  20
compiled vars:  !0 = $array, !1 = $count1, !2 = $sum, !3 = $count2, !4 = $sum2, !5 = $value3, !6 = $key3
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   54     1        ASSIGN                                                   !1, 0
   55     2        ASSIGN                                                   !2, 0
   56     3        ASSIGN                                                   !3, 0
   57     4        ASSIGN                                                   !4, 0
   83     5      > FE_RESET_R                                       $12     !0, ->15
          6    > > FE_FETCH_R                                       ~13     $12, !5, ->15
          7    >   ASSIGN                                                   !6, ~13
   86     8        INIT_FCALL                                               'isarr'
          9        SEND_VAR                                                 !5
         10        SEND_VAR                                                 !6
         11        SEND_VAL                                                 0
         12        SEND_VAL                                                 0
         13        DO_FCALL                                      0          
   83    14      > JMP                                                      ->6
         15    >   FE_FREE                                                  $12
   98    16        INIT_FCALL                                               'print_r'
         17        SEND_VAR                                                 !0
         18        DO_ICALL                                                 
         19      > RETURN                                                   1

Function isarr:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 28
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 28
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 22
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 27
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 27
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
filename:       /in/U7OoZ
function name:  isarr
number of ops:  34
compiled vars:  !0 = $array, !1 = $key7, !2 = $sum1, !3 = $count, !4 = $array2, !5 = $size, !6 = $value1, !7 = $key1, !8 = $count1
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   58     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
   60     4        INIT_FCALL                                               'array_values'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $9      
          7        ASSIGN                                                   !4, $9
   61     8        COUNT                                            ~11     !4
          9        ASSIGN                                                   !5, ~11
   62    10      > FE_RESET_R                                       $13     !0, ->28
         11    > > FE_FETCH_R                                       ~14     $13, !6, ->28
         12    >   ASSIGN                                                   !7, ~14
   64    13        TYPE_CHECK                                  128          !6
         14      > JMPZ                                                     ~16, ->22
   66    15    >   INIT_FCALL_BY_NAME                                       'isarr'
         16        SEND_VAR_EX                                              !6
         17        SEND_VAR_EX                                              !1
         18        SEND_VAR_EX                                              !2
         19        SEND_VAR_EX                                              !3
         20        DO_FCALL                                      0          
         21      > JMP                                                      ->27
   70    22    >   IS_EQUAL                                                 !7, '0'
         23      > JMPZ                                                     ~18, ->27
   72    24    >   ADD                                              ~19     !2, !6
         25        ASSIGN                                                   !2, ~19
         26        PRE_INC                                                  !8
   62    27    > > JMP                                                      ->11
         28    >   FE_FREE                                                  $13
   77    29        DIV                                              ~24     !2, !3
         30        FETCH_DIM_W                                      $22     !0, !1
         31        ASSIGN_DIM                                               $22, 0
         32        OP_DATA                                                  ~24
   79    33      > RETURN                                                   null

End of function isarr

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.6 ms | 1394 KiB | 18 Q