3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<!DOCTYPE html> <html> <body> <?php $even=0; $odd=0; $even_sum=0; $val_array = array(111, 56542, 893, 2354, 4545, 786, 9657, 3268, 4879, 9351, 7414, 4215, 3217, 1420); for ($i=0; $i < count($val_array); $i++) { if ($val_array[$i] % 2 == 0) { $even++; $even_sum=$even_sum + $val_array[$i]; } else { $odd++; } } echo "Total Even Numbers: " .$even."</br>"; echo "Total Odd Numbers: " .$odd."</br>"; echo $even_sum; ?> </body> </html>
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
<!DOCTYPE html> <html> <body> Total Even Numbers: 6</br>Total Odd Numbers: 8</br>71784 </body> </html>