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 ($res > 7) { for ($i = 0; $i < $len; $i++) { $newres = ($res - $i) / 37; if (is_int($newres)) { $result .= $alphabet[$i]; $res = $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.0140.00716.63
8.3.50.0090.01022.04
8.3.40.0090.01318.86
8.3.30.0060.00819.09
8.3.20.0000.00720.16
8.3.10.0070.00021.90
8.3.00.0050.00220.95
8.2.180.0130.00318.43
8.2.170.0100.01022.96
8.2.160.0070.01122.14
8.2.150.0070.00724.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0080.00019.56
8.2.110.0060.00320.48
8.2.100.0040.00818.04
8.2.90.0080.00018.34
8.2.80.0040.00417.97
8.2.70.0040.00417.75
8.2.60.0060.00317.93
8.2.50.0060.00318.07
8.2.40.0040.00420.07
8.2.30.0040.00418.19
8.2.20.0000.00717.82
8.2.10.0040.00418.23
8.2.00.0030.00517.74
8.1.280.0070.00725.92
8.1.270.0030.00620.84
8.1.260.0080.00026.35
8.1.250.0000.01028.09
8.1.240.0030.00722.24
8.1.230.0080.00320.91
8.1.220.0080.00017.74
8.1.210.0040.00418.88
8.1.200.0040.00417.22
8.1.190.0060.00317.10
8.1.180.0000.00818.10
8.1.170.0000.00818.59
8.1.160.0040.00422.05
8.1.150.0070.00318.95
8.1.140.0040.00419.23
8.1.130.0000.00817.81
8.1.120.0000.00717.51
8.1.110.0000.00817.37
8.1.100.0050.00317.43
8.1.90.0000.00817.39
8.1.80.0050.00217.49
8.1.70.0000.00717.43
8.1.60.0030.00617.62
8.1.50.0050.00317.50
8.1.40.0060.00317.53
8.1.30.0030.00517.59
8.1.20.0050.00317.63
8.1.10.0000.01017.59
8.1.00.0100.00017.53
8.0.300.0000.00820.00
8.0.290.0040.00416.75
8.0.280.0030.00318.51
8.0.270.0070.00017.32
8.0.260.0040.00417.22
8.0.250.0030.00316.94
8.0.240.0040.00417.01
8.0.230.0000.00716.95
8.0.220.0000.00716.94
8.0.210.0040.00417.07
8.0.200.0000.00717.01
8.0.190.0080.00017.02
8.0.180.0070.00016.95
8.0.170.0080.00016.99
8.0.160.0050.00217.00
8.0.150.0030.00316.93
8.0.140.0000.00716.89
8.0.130.0050.00013.46
8.0.120.0000.00816.96
8.0.110.0040.00416.80
8.0.100.0000.00817.00
8.0.90.0000.00816.86
8.0.80.0110.00716.95
8.0.70.0070.00016.79
8.0.60.0000.00716.98
8.0.50.0050.00316.98
8.0.30.0160.00717.14
8.0.20.0120.00917.40
8.0.10.0040.00416.92
8.0.00.0100.01016.89
7.4.330.0030.00315.03
7.4.320.0030.00316.44
7.4.300.0000.00616.63
7.4.290.0050.00316.61
7.4.280.0050.00216.54
7.4.270.0000.00716.59
7.4.260.0030.00716.50
7.4.250.0000.00716.58
7.4.240.0050.00316.47
7.4.230.0070.00016.61
7.4.220.0100.01016.70
7.4.210.0120.00316.57
7.4.200.0000.00716.66
7.4.160.0110.00516.53
7.4.150.0140.01117.40
7.4.140.0060.01317.86
7.4.130.0090.00816.54
7.4.120.0100.00716.47
7.4.110.0040.01516.70
7.4.100.0070.01416.65
7.4.90.0030.01416.47
7.4.80.0060.01019.39
7.4.70.0120.01216.40
7.4.60.0160.00316.51
7.4.50.0040.00016.28
7.4.40.0120.00616.60
7.4.30.0080.00816.41
7.4.00.0030.01015.00
7.3.330.0000.00713.31
7.3.320.0000.01213.47
7.3.310.0000.00716.49
7.3.300.0000.00716.45
7.3.290.0070.01016.45
7.3.280.0070.01116.41
7.3.270.0180.00017.40
7.3.260.0090.00916.48
7.3.250.0060.01216.51
7.3.240.0000.01716.58
7.3.230.0030.01316.59
7.3.210.0100.00716.41
7.3.200.0030.01819.39
7.3.190.0120.00416.55
7.3.180.0060.01016.51
7.3.170.0110.00816.43
7.3.160.0180.00316.45
7.2.330.0070.01116.47
7.2.320.0090.00916.72
7.2.310.0030.01516.81
7.2.300.0090.00916.71
7.2.290.0150.00316.80
7.2.60.0030.00916.79
7.2.50.0030.01317.04
7.2.00.0030.01219.46
7.1.200.0110.00015.68
7.1.100.0030.00717.71
7.1.70.0070.00317.34
7.1.60.0030.01319.46
7.1.50.0090.01217.02
7.1.00.0100.07022.46
7.0.200.0060.00616.71
7.0.140.0030.04721.93
7.0.60.0030.04019.91
7.0.50.0100.08018.00
7.0.40.0100.04720.40
7.0.30.0200.08320.16
7.0.20.0200.04320.34
7.0.10.0030.05020.21
7.0.00.0100.06320.25
5.6.280.0000.07721.07
5.6.210.0070.05720.52
5.6.200.0100.07018.29
5.6.190.0030.08320.49
5.6.180.0370.06320.57
5.6.170.0270.03020.56
5.6.160.0000.05020.39
5.6.150.0070.05318.23
5.6.140.0070.08018.14
5.6.130.0130.08018.19
5.6.120.0170.07021.02
5.6.110.0170.07321.01
5.6.100.0100.05321.05
5.6.90.0030.07721.14
5.6.80.0000.06020.43
5.5.350.0200.05020.42
5.5.340.0100.07317.99
5.5.330.0030.05320.26
5.5.320.0330.04720.20
5.5.310.0330.07020.34
5.5.300.0130.07017.98
5.5.290.0030.04718.07
5.5.280.0170.06320.82
5.5.270.0000.04320.95
5.5.260.0070.06020.65
5.5.250.0070.03720.79
5.5.240.0030.07720.25
5.4.450.0570.05319.53
5.4.440.0170.06019.59
5.4.430.0330.04719.30
5.4.420.0230.05019.42
5.4.410.0300.04719.21
5.4.400.0230.05019.00
5.4.390.0200.06018.63
5.4.380.0300.07018.80
5.4.370.0170.06018.81
5.4.360.0030.06718.57
5.4.350.0270.06018.73
5.4.340.0170.05318.59
5.4.320.0200.05318.46
5.4.310.0070.06718.57
5.4.300.0270.05318.70
5.4.290.0130.05718.79
5.4.280.0200.06018.75
5.4.270.0230.05018.76
5.4.260.0270.05018.47
5.4.250.0200.05718.75
5.4.240.0270.05318.60
5.4.230.0270.07718.48
5.4.220.0170.06318.52
5.4.210.0370.05318.79
5.4.200.0230.05016.59
5.4.190.0200.05318.48
5.4.180.0270.04318.51
5.4.170.0230.05018.71
5.4.160.0270.04718.78
5.4.150.0270.04718.81
5.4.140.0230.04716.46
5.4.130.0170.05016.28
5.4.120.0170.05016.30
5.4.110.0130.05016.23
5.4.100.0170.04716.37
5.4.90.0200.05016.42
5.4.80.0070.06016.36
5.4.70.0230.04316.26
5.4.60.0100.05716.41
5.4.50.0130.05716.30
5.4.40.0200.05316.39
5.4.30.0230.04716.28
5.4.20.0330.04316.39
5.4.10.0270.04016.30
5.4.00.0200.04715.69
5.3.290.0070.06714.89
5.3.280.0170.05314.62
5.3.270.0130.06014.79
5.3.260.0130.05714.61
5.3.250.0130.06014.72
5.3.240.0230.05014.69
5.3.230.0270.04714.79
5.3.220.0300.04314.63
5.3.210.0170.07714.67
5.3.200.0030.07014.55
5.3.190.0330.04014.76
5.3.180.0170.05714.68
5.3.170.0200.05014.73
5.3.160.0130.05314.70
5.3.150.0200.05014.67
5.3.140.0130.05314.60
5.3.130.0230.05014.59
5.3.120.0230.05014.80
5.3.110.0130.06014.69
5.3.100.0130.05314.11
5.3.90.0170.05014.07
5.3.80.0200.04714.01
5.3.70.0330.03714.06
5.3.60.0070.06014.13
5.3.50.0230.05014.07
5.3.40.0130.05714.00
5.3.30.0030.06313.94
5.3.20.0230.04013.74
5.3.10.0230.04013.88
5.3.00.0300.04013.68
5.2.170.0130.05311.20
5.2.160.0100.04711.18
5.2.150.0100.04711.25
5.2.140.0170.04011.25
5.2.130.0230.03011.23
5.2.120.0130.04011.14
5.2.110.0200.03311.16
5.2.100.0230.03011.14
5.2.90.0200.03311.13
5.2.80.0100.04711.08
5.2.70.0130.03711.10
5.2.60.0200.03011.28
5.2.50.0070.04311.05
5.2.40.0100.04011.05
5.2.30.0200.05011.01
5.2.20.0130.04011.02
5.2.10.0170.03710.97
5.2.00.0270.03010.83
5.1.60.0100.03710.14
5.1.50.0100.03710.01
5.1.40.0100.04010.02
5.1.30.0170.05010.52
5.1.20.0130.03710.39
5.1.10.0130.03710.16
5.1.00.0100.04310.12
5.0.50.0100.0279.51
5.0.40.0130.0209.51
5.0.30.0070.0439.51
5.0.20.0100.0279.51
5.0.10.0030.0339.51
5.0.00.0100.0409.51
4.4.90.0100.0209.51
4.4.80.0000.0279.51
4.4.70.0100.0209.51
4.4.60.0130.0179.51
4.4.50.0030.0239.51
4.4.40.0000.0409.51
4.4.30.0070.0209.51
4.4.20.0070.0339.51
4.4.10.0070.0209.51
4.4.00.0100.0339.51
4.3.110.0070.0239.51
4.3.100.0070.0209.51
4.3.90.0070.0209.51
4.3.80.0030.0379.51
4.3.70.0070.0209.51
4.3.60.0030.0239.51
4.3.50.0130.0179.51
4.3.40.0100.0439.51
4.3.30.0070.0279.51
4.3.20.0030.0309.51
4.3.10.0070.0209.51
4.3.00.0000.01714.57

preferences:
58.03 ms | 401 KiB | 5 Q