3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Function to check if a number is negative or not. Returns true if it isn't negative. function isntNegative($num) { if ($num < 0) { return false; } else { return true; } } // The function that extracts the mods from the mod value. function extractMods($modvalue) { // Declaring starting values. $startvalue = 1; $expon = 0; // $modsarray needs to be updated if a new mod it's added. $modsarray = array('Nofail', 'Easy', 'Novideo', 'Hidden', 'Hardrock', 'SuddenDeath', 'DoubleTime', 'Relax', 'HalfTime', 'Nightcore', 'Flashlight', 'Autoplay', 'SpunOut', 'Relax2', 'Perfect', 'Key4', 'Key5', 'Key6', 'Key7', 'Key8', 'FadeIn', 'Random', 'Lastmod'); // Check if it's Nomod or start loop if (isntNegative($modvalue - $startvalue)) { $returnarray = array(); while ($modvalue != 0) { if ($modvalue == 1) { $modvalue = 0; array_push($returnarray, $modsarray[0]); } else { do { $modvalue = $modvalue - $startvalue; $startvalue = $startvalue * 2; $expon++; }; while (isntNegative($modvalue)) { $modvalue2 = $modvalue; } array_push($returnarray, $modsarray[$expon]) } } return $returnarray; } else { return array('Nomod'); } } foreach ($holyshit as extractMods(1024 + 512)) { echo $holyshit; } ?>
Output for 5.4.0 - 5.4.31
Parse error: syntax error, unexpected ';', expecting while (T_WHILE) in /in/DUNJf on line 31
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected ';', expecting T_WHILE in /in/DUNJf on line 31
Process exited with code 255.

preferences:
173.92 ms | 1395 KiB | 68 Q