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 ) ) ); $array2 = array_values($array); $count1 = 0;$sum=0; $count2 = 0;$sum2=0; function isarr($array,$key7) { if(is_array($array)) { isarr($array); } else { if($key7 == "0") { //$sum = } } } foreach ($array as $key3 => $value3) { // isarr($value3,$key3); } //$array[21][0] = ($sum/$count1); //$array[23][0] = ($sum2/$count2); print_r($array2); echo $catCount = count(preg_grep("/^0+$/", array_keys(get_object_vars($array))));
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 13
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 13
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/cGb68
function name:  (null)
number of ops:  31
compiled vars:  !0 = $array, !1 = $array2, !2 = $count1, !3 = $sum, !4 = $count2, !5 = $sum2, !6 = $value3, !7 = $key3, !8 = $catCount
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   52     1        INIT_FCALL                                               'array_values'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $10     
          4        ASSIGN                                                   !1, $10
   54     5        ASSIGN                                                   !2, 0
          6        ASSIGN                                                   !3, 0
   55     7        ASSIGN                                                   !4, 0
          8        ASSIGN                                                   !5, 0
   73     9      > FE_RESET_R                                       $16     !0, ->13
         10    > > FE_FETCH_R                                       ~17     $16, !6, ->13
         11    >   ASSIGN                                                   !7, ~17
         12      > JMP                                                      ->10
         13    >   FE_FREE                                                  $16
   84    14        INIT_FCALL                                               'print_r'
         15        SEND_VAR                                                 !1
         16        DO_ICALL                                                 
   86    17        INIT_FCALL                                               'preg_grep'
         18        SEND_VAL                                                 '%2F%5E0%2B%24%2F'
         19        INIT_FCALL                                               'array_keys'
         20        INIT_FCALL                                               'get_object_vars'
         21        SEND_VAR                                                 !0
         22        DO_ICALL                                         $20     
         23        SEND_VAR                                                 $20
         24        DO_ICALL                                         $21     
         25        SEND_VAR                                                 $21
         26        DO_ICALL                                         $22     
         27        COUNT                                            ~23     $22
         28        ASSIGN                                           ~24     !8, ~23
         29        ECHO                                                     ~24
         30      > RETURN                                                   1

Function isarr:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 10
Branch analysis from position: 10
Branch analysis from position: 10
filename:       /in/cGb68
function name:  isarr
number of ops:  11
compiled vars:  !0 = $array, !1 = $key7
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   56     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   58     2        TYPE_CHECK                                  128          !0
          3      > JMPZ                                                     ~2, ->8
   60     4    >   INIT_FCALL_BY_NAME                                       'isarr'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0          
          7      > JMP                                                      ->10
   64     8    >   IS_EQUAL                                                 !1, '0'
          9      > JMPZ                                                     ~4, ->10
   69    10    > > RETURN                                                   null

End of function isarr

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
177.83 ms | 1400 KiB | 23 Q