3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function my_sum ($list){ $list_length = count($list); $sum = 0; for ($i = 0; $i < list_length; $i++){ print($i."<br />"); $sum = $sum + $list[$i]; return $sum; } } $list = array(5,2,3,9); $sum = my_sum($list); print("The sum of all array elements is $sum <br />"); ?>
Output for 4.3.0 - 5.6.28, hhvm-3.12.0, 7.0.0 - 7.1.0
Notice: Use of undefined constant list_length - assumed 'list_length' in /in/eFolT on line 5 The sum of all array elements is <br />
Output for hhvm-3.10.0

Process exited with code 153.