3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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.3.0 - 5.4.31
Parse error: syntax error, unexpected '{', expecting ';' in /in/aQILW on line 31
Process exited with code 255.