3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $arr = [ [1, 2, 3], [4, 5, 6], [7, 8, 9], ]; $sum = 0; $av = 0; for($i = 0 ; $i <= count($arr); $i++){ for ($j = 0; $j <= count($arr[$i]); $j++){ $sum += $arr[$i][$j]; $av = count($arr[$i][$j]); } } echo $arr[$i][$j], PHP_EOL; echo 'Сборът на масива е: ' . $sum, PHP_EOL, 'Средноаритметичната стойност е: ' . ($sum / $av);
Output for 7.2.0
Warning: count(): Parameter must be an array or an object that implements Countable in /in/907be on line 16 Warning: count(): Parameter must be an array or an object that implements Countable in /in/907be on line 16 Warning: count(): Parameter must be an array or an object that implements Countable in /in/907be on line 16 Notice: Undefined offset: 3 in /in/907be on line 15 Notice: Undefined offset: 3 in /in/907be on line 16 Warning: count(): Parameter must be an array or an object that implements Countable in /in/907be on line 16 Warning: count(): Parameter must be an array or an object that implements Countable in /in/907be on line 16 Warning: count(): Parameter must be an array or an object that implements Countable in /in/907be on line 16 Warning: count(): Parameter must be an array or an object that implements Countable in /in/907be on line 16 Notice: Undefined offset: 3 in /in/907be on line 15 Notice: Undefined offset: 3 in /in/907be on line 16 Warning: count(): Parameter must be an array or an object that implements Countable in /in/907be on line 16 Warning: count(): Parameter must be an array or an object that implements Countable in /in/907be on line 16 Warning: count(): Parameter must be an array or an object that implements Countable in /in/907be on line 16 Warning: count(): Parameter must be an array or an object that implements Countable in /in/907be on line 16 Notice: Undefined offset: 3 in /in/907be on line 15 Notice: Undefined offset: 3 in /in/907be on line 16 Warning: count(): Parameter must be an array or an object that implements Countable in /in/907be on line 16 Notice: Undefined offset: 3 in /in/907be on line 14 Warning: count(): Parameter must be an array or an object that implements Countable in /in/907be on line 14 Notice: Undefined offset: 3 in /in/907be on line 15 Notice: Undefined offset: 3 in /in/907be on line 16 Warning: count(): Parameter must be an array or an object that implements Countable in /in/907be on line 16 Notice: Undefined offset: 3 in /in/907be on line 14 Warning: count(): Parameter must be an array or an object that implements Countable in /in/907be on line 14 Notice: Undefined offset: 4 in /in/907be on line 20 Сборът на масива е: 45 Warning: Division by zero in /in/907be on line 22 Средноаритметичната стойност е: INF
Output for 7.0.0 - 7.1.10
Notice: Undefined offset: 3 in /in/907be on line 15 Notice: Undefined offset: 3 in /in/907be on line 16 Notice: Undefined offset: 3 in /in/907be on line 15 Notice: Undefined offset: 3 in /in/907be on line 16 Notice: Undefined offset: 3 in /in/907be on line 15 Notice: Undefined offset: 3 in /in/907be on line 16 Notice: Undefined offset: 3 in /in/907be on line 14 Notice: Undefined offset: 3 in /in/907be on line 15 Notice: Undefined offset: 3 in /in/907be on line 16 Notice: Undefined offset: 3 in /in/907be on line 14 Notice: Undefined offset: 4 in /in/907be on line 20 Сборът на масива е: 45 Warning: Division by zero in /in/907be on line 22 Средноаритметичната стойност е: INF
Output for 5.4.9 - 5.6.21
Notice: Undefined offset: 3 in /in/907be on line 15 Notice: Undefined offset: 3 in /in/907be on line 16 Notice: Undefined offset: 3 in /in/907be on line 15 Notice: Undefined offset: 3 in /in/907be on line 16 Notice: Undefined offset: 3 in /in/907be on line 15 Notice: Undefined offset: 3 in /in/907be on line 16 Notice: Undefined offset: 3 in /in/907be on line 14 Notice: Undefined offset: 3 in /in/907be on line 15 Notice: Undefined offset: 3 in /in/907be on line 16 Notice: Undefined offset: 3 in /in/907be on line 14 Notice: Undefined offset: 4 in /in/907be on line 20 Сборът на масива е: 45 Warning: Division by zero in /in/907be on line 22 Средноаритметичната стойност е:
Output for 5.3.19 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/907be on line 4
Process exited with code 255.