3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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);
Output for 7.1.0
Notice: Undefined variable: count1 in /in/bqJr7 on line 72 Fatal error: Uncaught ArgumentCountError: Too few arguments to function isarr(), 2 passed in /in/bqJr7 on line 66 and exactly 3 expected in /in/bqJr7:58 Stack trace: #0 /in/bqJr7(66): isarr(Array, 21) #1 /in/bqJr7(86): isarr(Array, 21, 3.5) #2 {main} thrown in /in/bqJr7 on line 58
Process exited with code 255.
Output for 5.1.0 - 5.6.21, 7.0.0 - 7.0.14
Notice: Undefined variable: count1 in /in/bqJr7 on line 72 Warning: Missing argument 3 for isarr(), called in /in/bqJr7 on line 66 and defined in /in/bqJr7 on line 58 Notice: Undefined variable: sum1 in /in/bqJr7 on line 72 Notice: Undefined variable: count1 in /in/bqJr7 on line 72 Warning: Missing argument 3 for isarr(), called in /in/bqJr7 on line 66 and defined in /in/bqJr7 on line 58 Notice: Undefined variable: sum1 in /in/bqJr7 on line 72 Notice: Undefined variable: count1 in /in/bqJr7 on line 72 Warning: Missing argument 3 for isarr(), called in /in/bqJr7 on line 66 and defined in /in/bqJr7 on line 58 Notice: Undefined variable: sum1 in /in/bqJr7 on line 72 Notice: Undefined variable: count1 in /in/bqJr7 on line 72 Notice: Undefined variable: count1 in /in/bqJr7 on line 72 Warning: Missing argument 3 for isarr(), called in /in/bqJr7 on line 66 and defined in /in/bqJr7 on line 58 Notice: Undefined variable: sum1 in /in/bqJr7 on line 72 Notice: Undefined variable: count1 in /in/bqJr7 on line 72 Warning: Missing argument 3 for isarr(), called in /in/bqJr7 on line 66 and defined in /in/bqJr7 on line 58 Notice: Undefined variable: sum1 in /in/bqJr7 on line 72 Notice: Undefined variable: count1 in /in/bqJr7 on line 72 Warning: Missing argument 3 for isarr(), called in /in/bqJr7 on line 66 and defined in /in/bqJr7 on line 58 Notice: Undefined variable: sum1 in /in/bqJr7 on line 72 Notice: Undefined variable: count1 in /in/bqJr7 on line 72 Warning: Missing argument 3 for isarr(), called in /in/bqJr7 on line 66 and defined in /in/bqJr7 on line 58 Notice: Undefined variable: sum1 in /in/bqJr7 on line 72 Notice: Undefined variable: count1 in /in/bqJr7 on line 72 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 ) ) )
Output for hhvm-3.10.0 - 3.12.0
Notice: Undefined variable: count1 in /in/bqJr7 on line 72 Warning: isarr() expects exactly 3 parameters, 2 given in /in/bqJr7 on line 60 Notice: Undefined variable: sum1 in /in/bqJr7 on line 72 Notice: Undefined variable: count1 in /in/bqJr7 on line 72 Warning: isarr() expects exactly 3 parameters, 2 given in /in/bqJr7 on line 60 Notice: Undefined variable: sum1 in /in/bqJr7 on line 72 Notice: Undefined variable: count1 in /in/bqJr7 on line 72 Warning: isarr() expects exactly 3 parameters, 2 given in /in/bqJr7 on line 60 Notice: Undefined variable: sum1 in /in/bqJr7 on line 72 Notice: Undefined variable: count1 in /in/bqJr7 on line 72 Notice: Undefined variable: count1 in /in/bqJr7 on line 72 Warning: isarr() expects exactly 3 parameters, 2 given in /in/bqJr7 on line 60 Notice: Undefined variable: sum1 in /in/bqJr7 on line 72 Notice: Undefined variable: count1 in /in/bqJr7 on line 72 Warning: isarr() expects exactly 3 parameters, 2 given in /in/bqJr7 on line 60 Notice: Undefined variable: sum1 in /in/bqJr7 on line 72 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 ) ) )
Output for 5.0.4 - 5.0.5
Notice: Undefined variable: count1 in /in/bqJr7 on line 72 Warning: Missing argument 3 for isarr() in /in/bqJr7 on line 58 Notice: Undefined variable: count1 in /in/bqJr7 on line 72 Warning: Missing argument 3 for isarr() in /in/bqJr7 on line 58 Notice: Undefined variable: count1 in /in/bqJr7 on line 72 Warning: Missing argument 3 for isarr() in /in/bqJr7 on line 58 Notice: Undefined variable: count1 in /in/bqJr7 on line 72 Notice: Undefined variable: count1 in /in/bqJr7 on line 72 Warning: Missing argument 3 for isarr() in /in/bqJr7 on line 58 Notice: Undefined variable: count1 in /in/bqJr7 on line 72 Warning: Missing argument 3 for isarr() in /in/bqJr7 on line 58 Notice: Undefined variable: count1 in /in/bqJr7 on line 72 Warning: Missing argument 3 for isarr() in /in/bqJr7 on line 58 Notice: Undefined variable: count1 in /in/bqJr7 on line 72 Warning: Missing argument 3 for isarr() in /in/bqJr7 on line 58 Notice: Undefined variable: count1 in /in/bqJr7 on line 72 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 ) ) )
Output for 4.3.0 - 5.0.3
Notice: Undefined variable: count1 in /in/bqJr7 on line 72 Warning: Missing argument 3 for isarr() in /in/bqJr7 on line 58 Notice: Undefined variable: count1 in /in/bqJr7 on line 72 Warning: Missing argument 3 for isarr() in /in/bqJr7 on line 58 Notice: Undefined variable: count1 in /in/bqJr7 on line 72 Warning: Missing argument 3 for isarr() in /in/bqJr7 on line 58 Notice: Undefined variable: count1 in /in/bqJr7 on line 72 Notice: Undefined variable: count1 in /in/bqJr7 on line 72 Warning: Missing argument 3 for isarr() in /in/bqJr7 on line 58 Notice: Undefined variable: count1 in /in/bqJr7 on line 72 Warning: Missing argument 3 for isarr() in /in/bqJr7 on line 58 Notice: Undefined variable: count1 in /in/bqJr7 on line 72 Warning: Missing argument 3 for isarr() in /in/bqJr7 on line 58 Notice: Undefined variable: count1 in /in/bqJr7 on line 72 Warning: Missing argument 3 for isarr() in /in/bqJr7 on line 58 Notice: Undefined variable: count1 in /in/bqJr7 on line 72 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 ) ) )