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; } ?>

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
5.4.310.0040.04412.52
5.4.300.0080.03612.53
5.4.290.0050.04112.52
5.4.280.0060.03712.42
5.4.270.0060.04112.42
5.4.260.0020.04112.42
5.4.250.0060.03912.42
5.4.240.0040.03812.42
5.4.230.0060.03812.41
5.4.220.0120.03112.41
5.4.210.0060.03512.41
5.4.200.0050.03912.41
5.4.190.0110.04712.41
5.4.180.0100.03712.41
5.4.170.0120.07312.41
5.4.160.0140.05312.41
5.4.150.0060.04512.40
5.4.140.0090.06112.10
5.4.130.0100.04712.08
5.4.120.0070.03712.05
5.4.110.0100.05412.04
5.4.100.0090.04712.04
5.4.90.0100.05112.04
5.4.80.0200.06712.04
5.4.70.0050.04612.04
5.4.60.0060.04812.03
5.4.50.0080.03812.03
5.4.40.0080.04912.02
5.4.30.0060.04512.02
5.4.20.0100.04212.02
5.4.10.0070.04012.02
5.4.00.0050.04111.51
5.3.280.0080.04512.70
5.3.270.0090.04912.72
5.3.260.0090.05512.72
5.3.250.0090.04112.72
5.3.240.0040.05112.72
5.3.230.0100.04312.71
5.3.220.0060.04712.68
5.3.210.0050.04912.68
5.3.200.0060.04412.68
5.3.190.0080.04012.68
5.3.180.0120.04212.67
5.3.170.0090.03512.67
5.3.160.0100.03612.68
5.3.150.0120.04912.67
5.3.140.0130.04512.66
5.3.130.0130.05312.66
5.3.120.0090.04312.66
5.3.110.0080.04112.66
5.3.100.0100.04412.13
5.3.90.0140.04712.11
5.3.80.0120.04512.10
5.3.70.0070.04912.10
5.3.60.0110.04512.08
5.3.50.0100.04612.03
5.3.40.0040.04312.03
5.3.30.0080.05011.99
5.3.20.0140.04011.77
5.3.10.0060.03611.73
5.3.00.0100.03411.72

preferences:
138.6 ms | 1394 KiB | 7 Q