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

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

End of function isarr

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.62 ms | 1407 KiB | 18 Q