3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Bijective { public $dictionary = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; public function __construct() { $this->dictionary = str_split($this->dictionary); } public function encode($i) { if ($i == 0) return $this->dictionary[0]; $result = ''; $base = count($this->dictionary); while ($i > 0) { $result[] = $this->dictionary[($i % $base)]; $i = floor($i / $base); } $result = array_reverse($result); return join("", $result); } public function decode($input) { $i = 0; $base = count($this->dictionary); $input = str_split($input); foreach($input as $char) { $pos = array_search($char, $this->dictionary); $i = $i * $base + $pos; } return $i; } } $bj = new Bijective(); $hash = $bj->encode($bj->decode('Abc') + 1); var_dump($hash);

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.0090.01218.55
8.3.50.0120.00722.11
8.3.40.0030.01319.01
8.3.30.0110.00419.02
8.3.20.0080.00020.35
8.3.10.0040.00420.48
8.3.00.0070.00023.71
8.2.180.0040.01116.75
8.2.170.0070.00722.96
8.2.160.0090.00922.25
8.2.150.0000.00724.18
8.2.140.0060.00324.66
8.2.130.0050.00320.72
8.2.120.0070.00026.35
8.2.110.0070.00322.16
8.2.100.0110.00017.93
8.2.90.0080.00019.36
8.2.80.0040.00417.97
8.2.70.0060.00317.47
8.2.60.0030.00518.16
8.2.50.0040.00418.09
8.2.40.0050.00320.53
8.2.30.0040.00419.57
8.2.20.0040.00417.88
8.2.10.0000.00718.17
8.2.00.0070.00018.11
8.1.280.0070.01125.92
8.1.270.0120.00322.19
8.1.260.0040.00428.09
8.1.250.0040.00428.09
8.1.240.0060.00320.82
8.1.230.0070.00417.70
8.1.220.0040.00417.76
8.1.210.0060.00318.77
8.1.200.0030.00617.35
8.1.190.0080.00017.35
8.1.180.0050.00318.10
8.1.170.0080.00018.50
8.1.160.0020.00520.87
8.1.150.0090.00020.71
8.1.140.0060.00319.57
8.1.130.0030.00317.71
8.1.120.0000.00717.46
8.1.110.0000.00717.34
8.1.100.0040.00417.50
8.1.90.0040.00417.46
8.1.80.0070.00017.37
8.1.70.0000.00717.37
8.1.60.0080.00017.58
8.1.50.0040.00417.47
8.1.40.0040.00417.40
8.1.30.0000.00817.57
8.1.20.0040.00417.56
8.1.10.0040.00417.61
8.1.00.0050.00317.53
8.0.300.0070.00018.77
8.0.290.0040.00416.63
8.0.280.0070.00018.45
8.0.270.0040.00417.31
8.0.260.0060.00017.26
8.0.250.0030.00317.05
8.0.240.0030.00316.93
8.0.230.0030.00517.04
8.0.220.0040.00416.99
8.0.210.0040.00716.93
8.0.200.0000.00716.91
8.0.190.0000.00717.02
8.0.180.0000.00817.04
8.0.170.0080.00016.94
8.0.160.0000.00716.97
8.0.150.0000.00716.96
8.0.140.0000.00816.95
8.0.130.0050.00013.43
8.0.120.0080.00016.85
8.0.110.0040.00416.96
8.0.100.0040.00416.95
8.0.90.0040.00416.98
8.0.80.0090.00616.95
8.0.70.0050.00216.74
8.0.60.0040.00416.96
8.0.50.0000.00716.84
8.0.30.0120.00717.15
8.0.20.0100.00917.40
8.0.10.0040.00416.90
8.0.00.0100.00916.68
7.4.330.0000.00516.66
7.4.320.0000.00716.60
7.4.300.0030.00316.61
7.4.290.0030.00616.61
7.4.280.0040.00416.59
7.4.270.0030.00316.62
7.4.260.0060.00316.60
7.4.250.0000.00716.48
7.4.240.0040.00416.52
7.4.230.0000.00716.44
7.4.220.0100.01216.38
7.4.210.0080.00816.58
7.4.200.0000.00716.39
7.4.160.0060.00916.52
7.4.150.0120.00617.40
7.4.140.0150.00517.86
7.4.130.0060.01116.63
7.4.120.0140.00816.58
7.4.110.0100.01016.68
7.4.100.0040.01716.41
7.4.90.0080.01016.50
7.4.80.0120.00719.39
7.4.70.0100.00716.77
7.4.60.0100.01516.40
7.4.50.0070.01016.27
7.4.40.0060.01816.49
7.4.30.0150.00716.51
7.4.00.0000.01115.18
7.3.330.0060.00013.31
7.3.320.0030.00213.27
7.3.310.0030.00316.46
7.3.300.0030.00316.33
7.3.290.0000.00716.30
7.3.280.0080.00916.44
7.3.270.0110.00617.40
7.3.260.0110.00516.40
7.3.250.0110.00816.36
7.3.240.0140.00616.56
7.3.230.0070.01016.58
7.3.210.0120.01216.44
7.3.200.0090.00716.57
7.3.190.0060.00916.56
7.3.180.0030.01916.48
7.3.170.0120.00616.58
7.3.160.0110.00516.34
7.2.330.0140.00316.69
7.2.320.0130.00416.49
7.2.310.0060.01516.73
7.2.300.0060.01616.68
7.2.290.0100.00716.49
7.2.60.0090.00316.93
7.1.200.0070.00715.91
7.1.70.0060.00617.21
7.1.60.0090.01619.40
7.1.50.0000.01216.78
7.1.00.0070.07322.57
7.0.200.0200.01014.91
7.0.60.0300.06721.68
7.0.50.0000.05317.87
7.0.40.0000.05020.24
7.0.30.0270.07720.13
7.0.20.0400.04720.25
7.0.10.0030.05320.32
7.0.00.0070.05020.27
5.6.280.0030.05321.11
5.6.210.0070.05020.51
5.6.200.0000.04318.12
5.6.190.0030.05720.57
5.6.180.0300.04720.39
5.6.170.0130.05320.71
5.6.160.0030.04320.49
5.6.150.0070.06318.23
5.6.140.0000.04318.21
5.6.130.0100.08018.13
5.6.120.0130.07721.02
5.6.110.0070.08021.09
5.6.100.0030.09020.98
5.6.90.0130.04721.13
5.6.80.0100.06320.38
5.5.350.4230.04020.39
5.5.340.0100.07018.05
5.5.330.0070.04020.30
5.5.320.0670.06320.34
5.5.310.0170.08020.37
5.5.300.0100.05317.96
5.5.290.0070.06718.08
5.5.280.0130.08020.87
5.5.270.0100.07320.87
5.5.260.0100.05720.80
5.5.250.0100.07720.72
5.5.240.0270.07720.19

preferences:
53.88 ms | 401 KiB | 5 Q