3v4l.org

run code in 300+ PHP versions simultaneously
<?php class HashCracker { private $range = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f']; private $length = 32; private $cycles = 1000; public function runBenchmark($hash, $prefix = '') { foreach ($this->range as $key) { $match = $prefix . $key; $timers[$match] = microtime(true); for ($i = 0; $i < $this->cycles; $i += 1) { // this is where you bomb the server stupidStringComparison($hash, $match); } $timers[$match] = microtime(true) - $timers[$match]; } asort($timers); end($timers); $hit = key($timers); var_dump($hit); if (strlen($hit) >= $this->length) { return $hit; } return $this->runBenchmark($hash, $hit); } } function stupidStringComparison($str1, $str2) { for ($i = 0; $i < strlen($str2) && $i < strlen($str1); $i += 1) { if ($str1[$i] !== $str2[$i]) { return false; } usleep(10); // yes, I can't get something reliable with my box otherwise because of cpu spikes } // really stupid - ignore this part. Just made up to inflate times return strlen($str1) === strlen($str2); } $password = 'hello'; $hashed = md5($password); var_dump('Hash to match: ' . $hashed); $cracked = (new HashCracker())->runBenchmark($hashed); var_dump('Cracked hash: ' . $cracked); var_dump($cracked === $hashed ? 'Success!' : 'Fail :( Retry!');

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)
7.1.70.0540.06016.77
7.1.60.1050.08019.17
7.1.50.0890.08917.14
7.1.00.0500.07022.35
7.0.200.1090.05414.84
7.0.140.0700.19722.08
7.0.70.5500.11320.07
7.0.60.0570.18020.06
7.0.50.0630.17317.86
7.0.40.0170.11019.95
7.0.30.0570.14020.00
7.0.20.0870.16019.85
7.0.10.0400.10019.82
7.0.00.0430.11019.81
5.6.280.0470.27020.91
5.6.210.0630.21020.64
5.6.200.0570.23018.26
5.6.190.0270.20020.36
5.6.180.0600.22320.48
5.6.170.0900.20020.39
5.6.160.0530.19320.33
5.6.150.0230.13318.18
5.6.140.0370.11018.24
5.6.130.0270.22318.17
5.6.120.0430.17721.02
5.6.110.0500.21721.04
5.6.100.0470.22720.91
5.6.90.0300.25021.03
5.6.80.0630.22720.46
5.6.70.0730.23720.50
5.5.350.0070.13020.46
5.5.340.0330.11717.91
5.5.330.0470.20320.19
5.5.320.0370.17720.23
5.5.310.1300.23320.13
5.5.300.0100.20717.98
5.5.290.0470.18317.98
5.5.280.0400.16720.79
5.5.270.0530.19720.67
5.5.260.0430.11320.70
5.5.250.0370.20720.57
5.5.240.0570.19720.21
5.4.450.1330.20019.28
5.4.440.0670.17319.33
5.4.430.0500.17319.22
5.4.420.0530.11719.11
5.4.410.0400.14319.14
5.4.400.3370.10318.79
5.4.390.2630.16319.05
5.4.380.0700.16019.04
5.4.370.0630.21019.02
5.4.360.0930.20719.07
5.4.350.0670.19018.95
5.4.340.0970.15318.94
5.4.320.0600.22019.03
5.4.310.0970.15318.80
5.4.300.0930.17319.04
5.4.290.0600.20319.05
5.4.280.1170.20019.04
5.4.270.1100.16319.19
5.4.260.0870.21318.93
5.4.250.1130.14319.03
5.4.240.1200.20915.60
5.4.230.1300.18915.72
5.4.220.1240.20215.64
5.4.210.1070.20715.79
5.4.200.0930.17915.71
5.4.190.0900.22215.81
5.4.180.0770.17915.69
5.4.170.0880.18615.71
5.4.160.0540.20215.69
5.4.150.2640.16715.76
5.4.140.3430.17614.21
5.4.130.3110.16414.20
5.4.120.1340.20514.14
5.4.110.1390.22114.22
5.4.100.1080.21814.08
5.4.90.0980.23514.29
5.4.80.0920.18114.27
5.4.70.1110.24514.26
5.4.60.0950.17114.08
5.4.50.1410.17314.13
5.4.40.1150.23914.25
5.4.30.1120.24014.24
5.4.20.1440.19914.26
5.4.10.1290.17214.11
5.4.00.3310.17113.60
5.3.290.3170.04014.68
5.3.280.1990.03913.74
5.3.270.2060.04413.61
5.3.260.1680.03913.69
5.3.250.0200.03613.62
5.3.240.1570.04213.61
5.3.230.0070.03913.72
5.3.220.1530.03513.57
5.3.210.0160.05613.63
5.3.200.0170.05313.57
5.3.190.1330.03713.67
5.3.180.0070.04213.73
5.3.170.0160.04613.61
5.3.160.0250.03313.57
5.3.150.0260.04413.62
5.3.140.0200.04913.61
5.3.130.1740.03613.64
5.3.120.0210.03813.61
5.3.110.0280.04713.55
5.3.100.0160.04913.15
5.3.90.0250.03313.05
5.3.80.0160.03813.15
5.3.70.0200.05113.04
5.3.60.0170.05413.06
5.3.50.0220.04312.92

preferences:
30.94 ms | 400 KiB | 5 Q