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) { $array2 = array_values($array); $size = sizeof($array2); foreach($array as $key1 => $value1) { if(is_array($value1)) { isarr($value1,$key7); } else { if($key1 == "0") { $sum1 = $sum1 + $value1;$count1++; } } } $array[$key7][0] = $sum1 / $count1; } foreach ($array as $key3 => $value3) { isarr($value3,$key3,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 = 14
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 14
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/bqJr7
function name:  (null)
number of ops:  19
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, ->14
          6    > > FE_FETCH_R                                       ~13     $12, !5, ->14
          7    >   ASSIGN                                                   !6, ~13
   86     8        INIT_FCALL                                               'isarr'
          9        SEND_VAR                                                 !5
         10        SEND_VAR                                                 !6
         11        SEND_VAL                                                 0
         12        DO_FCALL                                      0          
   83    13      > JMP                                                      ->6
         14    >   FE_FREE                                                  $12
   98    15        INIT_FCALL                                               'print_r'
         16        SEND_VAR                                                 !0
         17        DO_ICALL                                                 
         18      > RETURN                                                   1

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

End of function isarr

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.24 ms | 1403 KiB | 18 Q