3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php /** * For this test someone has written a lot of crap PHP code! * List all the problems you can find with this code and why it is a problem * */ function countVowelsInFile($f) { $handle = fopen($f, 'r'); while (!feof($handle)) $buf = fgets($handle, 4096); for ($i = 0; $i < strlen($buf); $i++) { if ($buf[$i] == 'a') $a++; if ($buf[$i] == 'e') $e++; if ($buf[$i] == 'i') $i++; if ($buf[$i] == 'o') $o++; if ($buf[$i] == 'u') $u++; if ($buf[$i] == 'e') $e++; } fclose($handle); return $a + $e + $i + $o + $u; } countVowelsInFile(__FILE__);
Output for 5.0.4 - 5.6.28, hhvm-3.12.0, 7.0.0 - 7.1.0
Notice: Undefined variable: o in /in/DgbMG on line 18 Notice: Undefined variable: u in /in/DgbMG on line 19 Notice: Undefined variable: e in /in/DgbMG on line 16 Notice: Undefined variable: a in /in/DgbMG on line 24
Output for hhvm-3.10.0

Process exited with code 153.
Output for 4.3.0 - 5.0.3
Notice: Undefined variable: o in /in/DgbMG on line 18 Notice: Undefined variable: u in /in/DgbMG on line 19 Notice: Undefined variable: e in /in/DgbMG on line 16 Notice: Undefined variable: a in /in/DgbMG on line 24