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 ) ) ); $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))));
Output for 5.3.0 - 5.6.28, 7.0.0 - 7.1.0
Warning: Division by zero in /in/Uu7P5 on line 81 Warning: Division by zero in /in/Uu7P5 on line 82 Array ( [0] => Array ( [0] => 3.5 [65] => Array ( [0] => 44.125 ) [150] => Array ( [0] => 15.25 ) [151] => Array ( [0] => 17.333333333333 ) ) [1] => Array ( [0] => 0 [166] => Array ( [0] => 26 ) [172] => Array ( [0] => 0 ) [182] => Array ( [0] => 20.333333333333 ) [183] => Array ( [0] => 24.125 ) ) ) Warning: get_object_vars() expects parameter 1 to be object, array given in /in/Uu7P5 on line 86 Warning: array_keys() expects parameter 1 to be array, null given in /in/Uu7P5 on line 86 Warning: preg_grep() expects parameter 2 to be array, null given in /in/Uu7P5 on line 86 0
Output for hhvm-3.10.0 - 3.12.0
Warning: Division by zero in /in/Uu7P5 on line 81 Warning: Division by zero in /in/Uu7P5 on line 82 Array ( [0] => Array ( [0] => 3.5 [65] => Array ( [0] => 44.125 ) [150] => Array ( [0] => 15.25 ) [151] => Array ( [0] => 17.333333333333 ) ) [1] => Array ( [0] => 0 [166] => Array ( [0] => 26 ) [172] => Array ( [0] => 0 ) [182] => Array ( [0] => 20.333333333333 ) [183] => Array ( [0] => 24.125 ) ) ) Warning: get_object_vars() expects parameter 1 to be object, array given in /in/Uu7P5 on line 86 Warning: array_keys() expects parameter 1 to be an array or collection in /in/Uu7P5 on line 86 Warning: preg_grep() expects parameter 2 to be array, null given in /in/Uu7P5 on line 86 0
Output for 5.2.0 - 5.2.17
Warning: Division by zero in /in/Uu7P5 on line 81 Warning: Division by zero in /in/Uu7P5 on line 82 Array ( [0] => Array ( [0] => 3.5 [65] => Array ( [0] => 44.125 ) [150] => Array ( [0] => 15.25 ) [151] => Array ( [0] => 17.333333333333 ) ) [1] => Array ( [0] => 0 [166] => Array ( [0] => 26 ) [172] => Array ( [0] => 0 ) [182] => Array ( [0] => 20.333333333333 ) [183] => Array ( [0] => 24.125 ) ) ) Warning: array_keys(): The first argument should be an array in /in/Uu7P5 on line 86 Warning: preg_grep() expects parameter 2 to be array, null given in /in/Uu7P5 on line 86 0
Output for 4.3.11 - 5.1.6
Warning: Division by zero in /in/Uu7P5 on line 81 Warning: Division by zero in /in/Uu7P5 on line 82 Array ( [0] => Array ( [0] => 3.5 [65] => Array ( [0] => 44.125 ) [150] => Array ( [0] => 15.25 ) [151] => Array ( [0] => 17.333333333333 ) ) [1] => Array ( [0] => 0 [166] => Array ( [0] => 26 ) [172] => Array ( [0] => 0 ) [182] => Array ( [0] => 20.333333333333 ) [183] => Array ( [0] => 24.125 ) ) ) Warning: array_keys(): The first argument should be an array in /in/Uu7P5 on line 86 Warning: preg_grep(): Second argument to preg_grep() should be an array in /in/Uu7P5 on line 86 0
Output for 4.3.2 - 4.3.10
Warning: Division by zero in /in/Uu7P5 on line 81 Warning: Division by zero in /in/Uu7P5 on line 82 Array ( [0] => Array ( [0] => 3.5 [65] => Array ( [0] => 44.125 ) [150] => Array ( [0] => 15.25 ) [151] => Array ( [0] => 17.333333333333 ) ) [1] => Array ( [0] => 0 [166] => Array ( [0] => 26 ) [172] => Array ( [0] => 0 ) [182] => Array ( [0] => 20.333333333333 ) [183] => Array ( [0] => 24.125 ) ) ) Warning: array_keys(): The first argument should be an array in /in/Uu7P5 on line 86 Warning: Second argument to preg_grep() should be an array in /in/Uu7P5 on line 86 0
Output for 4.3.0 - 4.3.1
Warning: Division by zero in /in/Uu7P5 on line 81 Warning: Division by zero in /in/Uu7P5 on line 82 Array ( [0] => Array ( [0] => 3.5 [65] => Array ( [0] => 44.125 ) [150] => Array ( [0] => 15.25 ) [151] => Array ( [0] => 17.333333333333 ) ) [1] => Array ( [0] => 0 [166] => Array ( [0] => 26 ) [172] => Array ( [0] => 0 ) [182] => Array ( [0] => 20.333333333333 ) [183] => Array ( [0] => 24.125 ) ) ) Warning: array_keys() [http://www.php.net/function.array-keys]: The first argument should be an array in /in/Uu7P5 on line 86 Warning: Second argument to preg_grep() should be an array in /in/Uu7P5 on line 86 0