3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo{ public static $alphabet = 'ABCDEFGHIKLMNOPQRSTVXYZabcdefghiklmnopqrstvxyz'; public static function shorten($number) { $alphabet = self::$alphabet; $base = strlen($alphabet); $number = intval($number, 10); $shortened = ""; while ($number > 0) { $remainder = $number % $base; $shortened = $alphabet[$remainder] . $shortened; $number = (int) ($number / $base); } return $shortened; } public static function unshorten($string) { $alphabet = self::$alphabet; $base = strlen($alphabet); $length = strlen($string); $returnVal = 0; for ($i=$length-1; $i >= 0; --$i) { $ind = strpos($alphabet, $string[$i]); if ($ind === false) { return false; } $returnVal += (int)($ind * pow($base, $i)); } return $returnVal; } } $shortened = Foo::shorten(12343336363636636); echo $shortened . "\n"; var_dump(Foo::unshorten($shortened));

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.40.0110.00718.79
8.3.30.0160.00319.17
8.3.20.0070.00020.30
8.3.10.0060.00321.95
8.3.00.0080.00022.57
8.2.170.0090.00622.96
8.2.160.0070.00722.13
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0070.00026.16
8.2.120.0150.00319.36
8.2.110.0080.00022.26
8.2.100.0030.00918.03
8.2.90.0080.00019.01
8.2.80.0050.00318.05
8.2.70.0090.00017.71
8.2.60.0050.00318.03
8.2.50.0040.00418.07
8.2.40.0000.00818.16
8.2.30.0070.00018.04
8.2.20.0000.00717.61
8.2.10.0030.00617.76
8.2.00.0040.00417.81
8.1.270.0040.00423.99
8.1.260.0020.00526.35
8.1.250.0050.00328.09
8.1.240.0030.00623.91
8.1.230.0110.00019.15
8.1.220.0040.00717.74
8.1.210.0080.00018.77
8.1.200.0060.00317.47
8.1.190.0040.00417.63
8.1.180.0000.00818.10
8.1.170.0100.00018.67
8.1.160.0040.00422.04
8.1.150.0040.00418.70
8.1.140.0000.00717.34
8.1.130.0040.00417.71
8.1.120.0000.00717.38
8.1.110.0000.00817.50
8.1.100.0030.00517.45
8.1.90.0000.00717.39
8.1.80.0000.00717.37
8.1.70.0000.00817.47
8.1.60.0030.00617.49
8.1.50.0040.00417.40
8.1.40.0040.00417.50
8.1.30.0000.00717.61
8.1.20.0030.00517.69
8.1.10.0050.00317.58
8.1.00.0050.00217.45
8.0.300.0070.00018.77
8.0.290.0080.00017.05
8.0.280.0070.00018.44
8.0.270.0070.00017.31
8.0.260.0070.00016.73
8.0.250.0000.00716.95
8.0.240.0050.00316.99
8.0.230.0030.00616.98
8.0.220.0040.00416.89
8.0.210.0030.00316.89
8.0.200.0000.00716.83
8.0.190.0050.00216.97
8.0.180.0000.00716.90
8.0.170.0040.00416.88
8.0.160.0040.00416.89
8.0.150.0030.00516.91
8.0.140.0040.00416.90
8.0.130.0000.00513.42
8.0.120.0040.00416.76
8.0.110.0040.00416.84
8.0.100.0030.00616.79
8.0.90.0070.00016.94
8.0.80.0060.01016.89
8.0.70.0000.00816.78
8.0.60.0050.00316.76
8.0.50.0050.00216.94
8.0.30.0040.01517.12
8.0.20.0100.01017.44
8.0.10.0030.00616.84
8.0.00.0110.00916.78
7.4.330.0030.00315.00
7.4.320.0000.00716.49
7.4.300.0000.00616.40
7.4.290.0050.00316.46
7.4.280.0030.00316.37
7.4.270.0030.00316.54
7.4.260.0030.00316.49
7.4.250.0000.00716.53
7.4.240.0020.00516.59
7.4.230.0000.00716.36
7.4.220.0030.01316.66
7.4.210.0080.01016.54
7.4.200.0030.00316.59
7.4.190.0070.00016.74
7.4.160.0040.01216.46
7.4.150.0090.01317.40
7.4.140.0100.00817.86
7.4.130.0050.01516.55
7.4.120.0070.01216.64
7.4.110.0110.00516.59
7.4.100.0140.00416.52
7.4.90.0110.00716.46
7.4.80.0110.01119.39
7.4.70.0070.01316.49
7.4.60.0140.00416.46
7.4.50.0000.00816.47
7.4.40.0090.00922.77
7.4.30.0080.00816.54
7.4.00.0060.00915.13
7.3.330.0030.00313.39
7.3.320.0020.00213.22
7.3.310.0030.00316.41
7.3.300.0050.00316.24
7.3.290.0110.00416.35
7.3.280.0080.00916.34
7.3.270.0080.00817.40
7.3.260.0100.01016.43
7.3.250.0100.00716.64
7.3.240.0160.01016.27
7.3.230.0090.00916.60
7.3.210.0130.00316.61
7.3.200.0090.00819.39
7.3.190.0040.01916.23
7.3.180.0130.00316.30
7.3.170.0100.00516.43
7.3.160.0090.01416.39
7.3.120.0040.01115.11
7.2.330.0140.00316.69
7.2.320.0120.00916.56
7.2.310.0110.00616.82
7.2.300.0060.01016.70
7.2.290.0080.00816.91
7.2.60.0130.00316.76
7.2.00.0000.01619.32
7.1.200.0060.00315.88
7.1.100.0070.00717.97
7.1.70.0040.00416.97
7.1.60.0130.00719.82
7.1.50.0030.02016.93
7.1.00.0000.07322.40
7.0.200.0000.00716.73
7.0.140.0000.08022.04
7.0.110.0600.08719.98
7.0.100.0470.09019.98
7.0.90.0570.05319.87
7.0.80.0670.07720.05
7.0.70.0630.08720.08
7.0.60.0530.08719.87
7.0.50.0570.07720.34
7.0.40.0100.07320.25
7.0.30.0100.07720.19
7.0.20.0130.07320.08
7.0.10.0070.08019.93
7.0.00.0070.08320.02
5.6.280.0070.07320.79
5.6.260.0070.08720.75
5.6.250.0130.07320.60
5.6.240.0000.09020.61
5.6.230.0100.07320.70
5.6.220.0070.08020.67
5.6.210.0100.07320.69
5.6.200.0100.08021.18
5.6.190.0100.08321.15
5.6.180.0130.05321.12
5.6.170.0100.08720.99
5.6.160.0100.08021.13
5.6.150.0070.08721.03
5.6.140.0170.06721.27
5.6.130.0070.08021.13
5.6.120.0030.05321.04
5.6.110.0170.07021.08
5.6.100.0130.04721.06
5.6.90.0100.08021.17
5.6.80.0030.08320.48
5.6.70.0030.06020.30
5.6.60.0030.07720.49
5.6.50.0030.07720.48
5.6.40.0130.07720.58
5.6.30.0030.08320.64
5.6.20.0030.08720.50
5.6.10.0100.07720.29
5.6.00.0100.06720.64
5.5.380.0070.07020.38
5.5.370.0130.08020.57
5.5.360.0070.08720.36
5.5.350.0130.07720.17
5.5.340.0130.08020.85
5.5.330.0000.08320.97
5.5.320.0100.07720.82
5.5.310.0230.04020.79
5.5.300.0130.07020.91
5.5.290.0200.06321.04
5.5.280.0100.08320.75
5.5.270.0070.07720.95
5.5.260.0100.08020.80
5.5.250.0070.07720.60
5.5.240.0130.07320.14
5.5.230.0030.06020.40
5.5.220.0100.08020.37
5.5.210.0030.05320.22
5.5.200.0070.08020.35
5.5.190.0170.06020.04
5.5.180.0100.07320.06
5.5.160.0070.08320.23
5.5.150.0100.07020.23
5.5.140.0200.07020.20
5.5.130.0030.08020.17
5.5.120.0070.07320.17
5.5.110.0070.06720.05
5.5.100.0030.04320.24
5.5.90.0030.04320.21
5.5.80.0030.06020.14
5.5.70.0030.04020.27
5.5.60.0070.03319.98
5.5.50.0030.03720.07
5.5.40.0070.03320.26
5.5.30.0000.04320.09
5.5.20.0200.02720.03
5.5.10.0030.05720.02
5.5.00.0100.04320.06
5.4.450.0070.07719.32
5.4.440.0100.07719.38
5.4.430.0200.06319.66
5.4.420.0170.07319.54
5.4.410.0100.07319.20
5.4.400.0130.04319.19
5.4.390.0100.07318.99
5.4.380.0070.04319.19
5.4.370.0030.07318.97
5.4.360.0130.04719.02
5.4.350.0030.05019.00
5.4.340.0030.07719.14
5.4.320.0200.05318.98
5.4.310.0070.08019.09
5.4.300.0030.07719.01
5.4.290.0070.07719.00
5.4.280.0070.07018.95
5.4.270.0070.05719.24
5.4.260.0070.05719.00
5.4.250.0070.06019.00
5.4.240.0030.04719.05
5.4.230.0030.04018.94
5.4.220.0030.04019.30
5.4.210.0000.04319.00
5.4.200.0000.04019.08
5.4.190.0000.04319.14
5.4.180.0070.03319.25
5.4.170.0030.04018.99
5.4.160.0030.04319.17
5.4.150.0030.04018.99
5.4.140.0030.03716.47
5.4.130.0000.04016.38
5.4.120.0030.03316.35
5.4.110.0100.04316.53
5.4.100.0100.04316.51
5.4.90.0070.03316.41
5.4.80.0100.06716.45
5.4.70.0000.03716.57
5.4.60.0070.03316.54
5.4.50.0070.06716.23
5.4.40.0000.04016.45
5.4.30.0100.04716.51
5.4.20.0070.03716.60
5.4.10.0100.04316.53
5.4.00.0170.02015.88
5.3.290.0030.04314.64
5.3.280.0000.06714.56
5.3.270.0030.03714.61
5.3.260.0170.06014.74
5.3.250.0000.04014.69
5.3.240.0030.04014.61
5.3.230.0000.04714.75
5.3.220.0070.03714.57
5.3.210.0070.03714.60
5.3.200.0100.02714.43
5.3.190.0070.03014.66
5.3.180.0030.04014.57
5.3.170.0070.03314.54
5.3.160.0000.05014.60
5.3.150.0000.04014.80
5.3.140.0030.05314.55
5.3.130.0030.03714.64
5.3.120.0030.03714.78
5.3.110.0070.04014.63
5.3.100.0030.03714.14
5.3.90.0000.04014.17
5.3.80.0070.05714.04
5.3.70.0030.04314.25
5.3.60.0000.04014.04
5.3.50.0000.03714.09
5.3.40.0070.03313.95
5.3.30.0030.03313.90
5.3.20.0100.03313.78
5.3.10.0000.04013.64
5.3.00.0070.03713.66
5.2.170.0030.03011.97
5.2.160.0070.02711.97
5.2.150.0030.04011.97
5.2.140.0000.03011.97
5.2.130.0070.03711.97
5.2.120.0070.02011.97
5.2.110.0030.04311.97
5.2.100.0070.04011.97
5.2.90.0070.03011.97
5.2.80.0070.05311.97
5.2.70.0070.06011.97
5.2.60.0000.03011.97
5.2.50.0070.02311.97
5.2.40.0000.03011.97
5.2.30.0000.03011.97
5.2.20.0030.02711.97
5.2.10.0030.04011.97
5.2.00.0070.06011.97
5.1.60.0100.04711.97
5.1.50.0070.05311.97
5.1.40.0030.05311.97
5.1.30.0070.05311.97
5.1.20.0030.05711.97
5.1.10.0000.06011.97
5.1.00.0070.03011.97
5.0.50.0030.04711.97
5.0.40.0000.04711.97
5.0.30.0000.05011.97
5.0.20.0030.03711.97
5.0.10.0000.04711.97
5.0.00.0030.06311.97
4.4.90.0000.01711.97
4.4.80.0000.01711.97
4.4.70.0030.01311.97
4.4.60.0000.01711.97
4.4.50.0030.03311.97
4.4.40.0030.05011.97
4.4.30.0030.03711.97
4.4.20.0000.04311.97
4.4.10.0070.03311.97
4.4.00.0070.05311.97
4.3.110.0070.01711.97
4.3.100.0030.03311.97
4.3.90.0000.03711.97
4.3.80.0030.02711.97
4.3.70.0030.03711.97
4.3.60.0070.03011.97
4.3.50.0030.02011.97
4.3.40.0000.05311.97
4.3.30.0030.03011.97
4.3.20.0000.03711.97
4.3.10.0000.03311.97
4.3.00.0000.02011.97

preferences:
36.08 ms | 400 KiB | 5 Q