3v4l.org

run code in 300+ PHP versions simultaneously
<?php define('ALPHABET', 'acdegilmnoprstuw'); $hash = 680131659347; $string = 'leepadg'; echo sprintf('Hash of string «%s» is «%s».', $string, get_hash(ALPHABET, $string)), PHP_EOL , sprintf('String of hash «%s» is «%s».', $hash, unhash(ALPHABET, $hash)) ; function get_hash($alphabet, $string) { $h = 7; $len = strlen($string); for($i = 0; $i < $len; $i++) { $h = ($h * 37 + strpos($alphabet, $string[$i])); } return $h; } function unhash($alphabet, $hash) { $result = ''; $len = strlen($alphabet); while ($hash > 7) { for ($i = 0; $i < $len; $i++) { $newres = ($hash - $i) / 37; if (is_int($newres)) { $result .= $alphabet[$i]; $hash = $newres; break; } } return strrev($result); } }

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)
8.3.60.0040.01816.50
8.3.50.0090.00922.01
8.3.40.0140.00718.82
8.3.30.0070.00719.18
8.3.20.0060.00320.42
8.3.10.0060.00321.47
8.3.00.0050.00220.96
8.2.180.0140.00325.92
8.2.170.0070.00722.96
8.2.160.0100.00722.00
8.2.150.0080.00024.18
8.2.140.0000.00824.66
8.2.130.0070.00026.16
8.2.120.0040.00419.66
8.2.110.0060.00321.04
8.2.100.0100.00017.78
8.2.90.0000.00817.75
8.2.80.0000.00818.96
8.2.70.0090.00017.63
8.2.60.0030.00617.93
8.2.50.0080.00018.07
8.2.40.0000.00819.88
8.2.30.0050.00218.11
8.2.20.0000.00717.63
8.2.10.0000.00818.03
8.2.00.0040.00417.81
8.1.280.0070.00725.92
8.1.270.0080.00020.61
8.1.260.0000.00826.35
8.1.250.0090.00028.09
8.1.240.0080.00422.08
8.1.230.0040.00820.97
8.1.220.0050.00318.60
8.1.210.0040.00418.77
8.1.200.0060.00317.35
8.1.190.0040.00417.00
8.1.180.0040.00418.10
8.1.170.0050.00318.52
8.1.160.0030.00522.08
8.1.150.0040.00418.86
8.1.140.0000.00819.20
8.1.130.0000.00717.82
8.1.120.0070.00017.39
8.1.110.0030.00517.51
8.1.100.0070.00017.48
8.1.90.0040.00417.36
8.1.80.0040.00417.51
8.1.70.0030.00317.30
8.1.60.0030.00717.48
8.1.50.0060.00317.47
8.1.40.0040.00417.47
8.1.30.0060.00317.66
8.1.20.0000.00817.64
8.1.10.0080.00017.48
8.1.00.0070.00617.57
8.0.300.0060.00319.98
8.0.290.0060.00316.75
8.0.280.0070.00018.44
8.0.270.0000.00717.27
8.0.260.0080.00317.21
8.0.250.0030.00316.98
8.0.240.0040.00416.95
8.0.230.0070.00017.04
8.0.220.0070.00016.80
8.0.210.0030.00316.93
8.0.200.0030.00317.01
8.0.190.0040.00416.87
8.0.180.0070.00016.95
8.0.170.0030.00616.89
8.0.160.0070.00016.89
8.0.150.0000.00716.84
8.0.140.0030.00516.71
8.0.130.0060.00013.38
8.0.120.0080.00016.81
8.0.110.0040.00416.74
8.0.100.0050.00216.77
8.0.90.0040.00417.02
8.0.80.0110.01116.87
8.0.70.0000.00716.72
8.0.60.0050.00216.74
8.0.50.0040.00416.92
8.0.30.0090.01417.12
8.0.20.0160.00817.40
8.0.10.0070.00016.89
8.0.00.0080.01316.72
7.4.330.0000.00715.03
7.4.320.0040.00416.48
7.4.300.0060.00016.46
7.4.290.0030.00316.61
7.4.280.0040.00416.62
7.4.270.0000.00716.61
7.4.260.0000.00916.51
7.4.250.0040.00416.59
7.4.240.0020.00616.63
7.4.230.0030.00316.73
7.4.220.0090.00916.68
7.4.210.0040.01116.56
7.4.200.0060.00316.52
7.4.160.0110.00516.52
7.4.150.0150.00617.40
7.4.140.0090.00917.86
7.4.130.0080.01016.45
7.4.120.0100.00816.50
7.4.110.0060.01216.58
7.4.100.0120.00616.54
7.4.90.0080.00816.52
7.4.80.0140.00419.39
7.4.70.0100.00716.68
7.4.60.0060.01016.52
7.4.50.0030.00316.51
7.4.40.0030.01516.52
7.4.30.0060.01116.68
7.4.00.0040.01415.11
7.3.330.0030.00313.40
7.3.320.0150.00013.20
7.3.310.0000.00616.43
7.3.300.0030.00316.35
7.3.290.0060.00916.37
7.3.280.0070.01116.37
7.3.270.0040.01317.40
7.3.260.0070.01016.48
7.3.250.0060.01116.41
7.3.240.0160.00316.68
7.3.230.0000.01716.61
7.3.210.0130.00316.70
7.3.200.0110.00719.39
7.3.190.0130.00316.55
7.3.180.0030.01316.43
7.3.170.0080.01816.36
7.3.160.0090.00616.37
7.2.330.0090.00916.76
7.2.320.0080.00816.77
7.2.310.0110.01416.46
7.2.300.0130.00316.54
7.2.290.0130.01016.80
7.2.60.0200.00716.71
7.2.50.0100.00316.93
7.2.00.0030.00919.37
7.1.200.0030.01015.86
7.1.100.0060.00918.36
7.1.70.0040.00417.37
7.1.60.0070.00419.46
7.1.50.0110.01116.75
7.1.00.0000.08022.57
7.0.200.0160.00016.76
7.0.140.0070.05722.00
7.0.60.0100.08320.00
7.0.50.0070.03717.93
7.0.40.0100.07720.24
7.0.30.0500.04320.27
7.0.20.0270.05720.34
7.0.10.0100.08020.25
7.0.00.0030.05020.19
5.6.280.0030.07321.04
5.6.210.0030.07320.50
5.6.200.0030.09018.16
5.6.190.0130.08320.58
5.6.180.3030.04020.56
5.6.170.0300.05720.62
5.6.160.0030.06720.39
5.6.150.0000.07318.27
5.6.140.0070.08318.14
5.6.130.0070.07718.15
5.6.120.0030.06020.99
5.6.110.0070.06021.03
5.6.100.0070.06720.99
5.6.90.0200.02720.98
5.6.80.0100.07720.54
5.6.70.0330.05320.41
5.5.350.0270.07020.34
5.5.340.0130.06717.99
5.5.330.0070.06020.38
5.5.320.0370.05020.27
5.5.310.0470.06320.30
5.5.300.0030.04018.03
5.5.290.0070.03718.08
5.5.280.0030.08020.88
5.5.270.0030.09320.80
5.5.260.0030.04020.69
5.5.250.0070.03720.47
5.5.240.0370.06720.30
5.4.450.0670.05719.48
5.4.440.0170.05719.62
5.4.430.0100.05719.55
5.4.420.0200.05019.16
5.4.410.0170.06319.18
5.4.400.0200.05019.23
5.4.390.0230.04718.75
5.4.380.0270.05318.51
5.4.370.0330.05318.76
5.4.360.0200.05718.51
5.4.350.0200.05318.60
5.4.340.0270.04718.80
5.4.320.0200.05318.63
5.4.310.0270.04718.59
5.4.300.0130.05718.80
5.4.290.0200.05318.62
5.4.280.0200.05318.80
5.4.270.0300.04318.86
5.4.260.0230.05018.72
5.4.250.0100.06718.79
5.4.240.0130.06018.53
5.4.230.0270.04718.55
5.4.220.0300.04718.85
5.4.210.0200.05018.71
5.4.200.0200.05016.55
5.4.190.0100.06318.58
5.4.180.0300.05718.69
5.4.170.0000.00018.80
5.4.160.0230.05318.76
5.4.150.0200.06018.77
5.4.140.0170.05316.20
5.4.130.0230.05316.18
5.4.120.0200.05316.46
5.4.110.0170.05316.30
5.4.100.0230.05716.45
5.4.90.0200.05316.28
5.4.80.0130.05716.20
5.4.70.0200.05016.34
5.4.60.0230.04316.29
5.4.50.0200.04716.29
5.4.40.0170.05316.15
5.4.30.0170.05016.27
5.4.20.0200.05016.25
5.4.10.0230.04716.26
5.4.00.0270.04015.71
5.3.290.0070.06714.78
5.3.280.0100.05714.64
5.3.270.0200.05714.72
5.3.260.0130.06014.67
5.3.250.0170.06014.75
5.3.240.0130.06014.79
5.3.230.0300.05314.62
5.3.220.0200.05314.61
5.3.210.0100.06314.78
5.3.200.0130.06014.80
5.3.190.0130.06014.68
5.3.180.0170.06314.70
5.3.170.0200.05014.75
5.3.160.0200.05014.60
5.3.150.0130.05714.55
5.3.140.0130.05714.70
5.3.130.0170.06014.61
5.3.120.0270.04714.66
5.3.110.0300.07014.61
5.3.100.0330.05314.23
5.3.90.0270.04314.06
5.3.80.0330.05714.10
5.3.70.0230.04714.01
5.3.60.0270.04314.09
5.3.50.0170.05313.97
5.3.40.0230.05013.99
5.3.30.0170.05014.04
5.3.20.0270.04313.73
5.3.10.0200.05013.65
5.3.00.0300.04013.71
5.2.170.0170.04011.25
5.2.160.0130.04711.21
5.2.150.0430.03311.27
5.2.140.0200.04311.16
5.2.130.0130.04311.16
5.2.120.0100.04711.13
5.2.110.0270.03711.15
5.2.100.0130.04311.23
5.2.90.0170.04011.14
5.2.80.0230.05011.10
5.2.70.0130.04311.23
5.2.60.0130.04711.18
5.2.50.0170.05011.23
5.2.40.0170.04711.11
5.2.30.0170.03711.10
5.2.20.0100.04311.11
5.2.10.0200.03310.96
5.2.00.0230.04010.74
5.1.60.0230.02310.21
5.1.50.0130.03710.03
5.1.40.0170.03310.17
5.1.30.0200.03310.38
5.1.20.0230.04710.38
5.1.10.0170.03310.12
5.1.00.0200.03010.29
5.0.50.0030.0379.51
5.0.40.0030.0409.51
5.0.30.0170.0539.51
5.0.20.0100.0409.51
5.0.10.0100.0409.51
5.0.00.0100.0439.51
4.4.90.0130.0139.51
4.4.80.0100.0209.51
4.4.70.0070.0209.51
4.4.60.0070.0239.51
4.4.50.0100.0239.51
4.4.40.0070.0379.51
4.4.30.0270.0109.51
4.4.20.0100.0209.51
4.4.10.0030.0279.51
4.4.00.0070.0339.51
4.3.110.0170.0179.51
4.3.100.0100.0209.51
4.3.90.0030.0239.51
4.3.80.0070.0339.51
4.3.70.0100.0179.51
4.3.60.0030.0239.51
4.3.50.0030.0239.51
4.3.40.0100.0309.51
4.3.30.0070.0209.51
4.3.20.0030.0239.51
4.3.10.0030.0239.51
4.3.00.0100.0277.06

preferences:
61.01 ms | 401 KiB | 5 Q