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)($alphabet[$ind] * pow($base, $i)); } } } $shortened = Foo::shorten(12343336363636636); echo $shortened . "\n"; echo 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.60.0060.01318.48
8.3.50.0130.01022.10
8.3.40.0140.00418.78
8.3.30.0100.01018.91
8.3.20.0040.00420.29
8.3.10.0050.00322.14
8.3.00.0040.01122.45
8.2.180.0080.00816.48
8.2.170.0040.01122.96
8.2.160.0000.01422.27
8.2.150.0100.01024.18
8.2.140.0030.00524.66
8.2.130.0070.00026.16
8.2.120.0060.00318.89
8.2.110.0090.00022.10
8.2.100.0030.00919.54
8.2.90.0030.00619.30
8.2.80.0080.00018.01
8.2.70.0060.00617.50
8.2.60.0050.00318.03
8.2.50.0040.00718.07
8.2.40.0070.00318.34
8.2.30.0040.00418.09
8.2.20.0040.00417.72
8.2.10.0060.00317.70
8.2.00.0040.00417.75
8.1.280.0070.01425.92
8.1.270.0060.00322.26
8.1.260.0000.00826.35
8.1.250.0060.00328.09
8.1.240.0090.00023.79
8.1.230.0110.00019.22
8.1.220.0050.00317.88
8.1.210.0040.00418.77
8.1.200.0040.00517.35
8.1.190.0040.00417.54
8.1.180.0080.00018.10
8.1.170.0030.00618.59
8.1.160.0030.00521.90
8.1.150.0080.00318.57
8.1.140.0040.00417.43
8.1.130.0040.00417.89
8.1.120.0040.00417.49
8.1.110.0000.00717.43
8.1.100.0040.00417.47
8.1.90.0040.00417.28
8.1.80.0040.00417.45
8.1.70.0000.00717.42
8.1.60.0040.00417.48
8.1.50.0040.00417.48
8.1.40.0050.00317.44
8.1.30.0040.00417.56
8.1.20.0000.00817.73
8.1.10.0060.00317.57
8.1.00.0040.00417.52
8.0.300.0040.00418.77
8.0.290.0040.00417.18
8.0.280.0000.00718.49
8.0.270.0070.00017.27
8.0.260.0030.00516.94
8.0.250.0030.00317.04
8.0.240.0040.00417.02
8.0.230.0050.00317.03
8.0.220.0000.00717.00
8.0.210.0000.00717.03
8.0.200.0000.00817.00
8.0.190.0040.00417.00
8.0.180.0040.00416.91
8.0.170.0030.00416.99
8.0.160.0070.00016.86
8.0.150.0000.00716.91
8.0.140.0000.00716.91
8.0.130.0030.00313.44
8.0.120.0050.00316.78
8.0.110.0050.00217.01
8.0.100.0030.00516.78
8.0.90.0040.00416.83
8.0.80.0100.01316.98
8.0.70.0000.00817.08
8.0.60.0000.00816.90
8.0.50.0050.00316.86
8.0.30.0110.01117.08
8.0.20.0090.00917.40
8.0.10.0050.00317.14
8.0.00.0120.00716.79
7.4.330.0000.00715.00
7.4.320.0060.00016.52
7.4.300.0070.00016.50
7.4.290.0000.00716.51
7.4.280.0050.00316.52
7.4.270.0070.00016.59
7.4.260.0030.00516.49
7.4.250.0040.00416.59
7.4.240.0020.00516.53
7.4.230.0030.00316.68
7.4.220.0110.00716.71
7.4.210.0090.00716.67
7.4.200.0070.00016.67
7.4.190.0000.00716.74
7.4.160.0060.01116.48
7.4.150.0120.00617.40
7.4.140.0080.01117.86
7.4.130.0080.00916.51
7.4.120.0080.00916.46
7.4.110.0100.00716.50
7.4.100.0130.01016.50
7.4.90.0030.01616.57
7.4.80.0080.01519.39
7.4.70.0080.00816.56
7.4.60.0190.00416.46
7.4.50.0040.00416.55
7.4.40.0000.01422.77
7.4.30.0080.00816.51
7.4.00.0070.01014.98
7.3.330.0030.00313.21
7.3.320.0030.00313.25
7.3.310.0030.00316.47
7.3.300.0030.00316.45
7.3.290.0060.01216.45
7.3.280.0100.00716.36
7.3.270.0140.00317.40
7.3.260.0100.00716.47
7.3.250.0090.00716.54
7.3.240.0060.01116.45
7.3.230.0050.01116.70
7.3.210.0120.00616.35
7.3.200.0140.00919.39
7.3.190.0070.01316.48
7.3.180.0100.00616.36
7.3.170.0070.01416.52
7.3.160.0000.02216.40
7.3.120.0100.00715.07
7.3.110.0070.00714.88
7.3.100.0030.01414.98
7.3.90.0060.00615.03
7.3.80.0090.00614.86
7.3.70.0080.00614.70
7.3.60.0040.00414.95
7.3.50.0100.00614.70
7.3.40.0040.01114.93
7.3.30.0040.00714.55
7.3.20.0070.00716.70
7.3.10.0160.00016.65
7.3.00.0000.01416.87
7.2.330.0160.00316.85
7.2.320.0060.01216.96
7.2.310.0070.01116.83
7.2.300.0130.00716.71
7.2.290.0110.00716.90
7.2.240.0030.01015.08
7.2.230.0100.00315.09
7.2.220.0040.01115.08
7.2.210.0070.01114.89
7.2.200.0030.01015.23
7.2.190.0090.00615.14
7.2.180.0060.01015.10
7.2.170.0090.00615.16
7.2.160.0070.01015.12
7.2.150.0040.01116.79
7.2.140.0130.00316.77
7.2.130.0150.00016.84
7.2.120.0100.00316.95
7.2.110.0030.01316.77
7.2.100.0100.00616.65
7.2.90.0070.00716.95
7.2.80.0040.01417.16
7.2.70.0070.01017.07
7.2.60.0060.00617.04
7.2.50.0030.01416.80
7.2.40.0080.00816.75
7.2.30.0090.00016.78
7.2.20.0060.00617.00
7.2.10.0030.01317.00
7.2.00.0100.00817.95
7.1.330.0030.01415.87
7.1.320.0100.00315.71
7.1.310.0040.01115.93
7.1.300.0060.00915.62
7.1.290.0090.00615.74
7.1.280.0040.01115.92
7.1.270.0030.01015.82
7.1.260.0070.00715.63
7.1.250.0100.00315.74
7.1.200.0060.00316.07
7.1.100.0040.01118.36
7.1.70.0130.00416.88
7.1.60.0060.01819.82
7.1.50.0030.02017.00
7.1.00.0100.07022.40
7.0.200.0040.00416.69
7.0.140.0030.07322.21
7.0.60.0030.04019.91
7.0.50.0070.03717.89
7.0.40.0070.06020.08
7.0.30.0500.05320.25
7.0.20.0270.04020.30
7.0.10.0070.06320.08
7.0.00.0030.06320.32
5.6.210.0100.07720.48
5.6.200.0100.07718.12
5.6.190.0070.06020.64
5.6.180.0130.05020.39
5.6.170.0200.04020.57
5.6.160.0100.08320.61
5.6.150.0100.05318.14
5.6.140.0170.06018.11
5.6.130.0070.05018.27
5.6.120.0130.06021.10
5.6.110.0100.08321.12
5.6.100.0070.08720.98
5.6.90.0130.08021.12
5.6.80.0070.08020.53
5.5.350.0030.07720.36
5.5.340.0070.08017.94
5.5.330.0130.03320.47
5.5.320.3930.04020.27
5.5.310.0370.08320.26
5.5.300.0070.07018.02
5.5.290.0100.04017.97
5.5.280.0030.04320.99
5.5.270.0100.07020.64
5.5.260.0170.06020.80
5.5.250.0100.07020.47
5.5.240.0200.07720.27
5.4.450.0300.05719.46
5.4.440.0800.04319.24
5.4.430.0330.05019.47
5.4.420.0170.05319.51
5.4.410.0200.04319.42
5.4.400.1530.00018.50
5.4.390.1470.00018.61
5.4.380.0900.07018.57
5.4.370.0230.05018.83
5.4.360.0430.04018.50
5.4.350.0100.06018.75
5.4.340.0230.04718.75
5.4.320.0040.03712.50
5.4.310.0060.04412.50
5.4.300.0080.04312.50
5.4.290.0080.04712.50
5.4.280.0050.04312.40
5.4.270.0130.05718.90
5.4.260.0130.05019.09
5.4.250.0100.06018.78
5.4.240.0070.07718.75
5.4.230.0130.07018.94
5.4.220.0070.07318.93
5.4.210.0100.06019.02
5.4.200.0130.06318.89
5.4.190.0100.07718.79
5.4.180.0070.07319.08
5.4.170.0170.06318.73
5.4.160.0170.05318.73
5.4.150.0100.05718.75
5.4.140.0130.07016.53
5.4.130.0130.04316.54
5.4.120.0130.07316.38
5.4.110.0100.07316.57
5.4.100.0030.05716.56
5.4.90.0070.05716.61
5.4.80.0130.05316.63
5.4.70.0030.06016.55
5.4.60.0100.07016.44
5.4.50.0130.06716.30
5.4.40.0270.03716.44
5.4.30.0100.05316.53
5.4.20.0070.05316.53
5.4.10.0030.07316.46
5.4.00.0170.04715.76
5.3.290.0070.03912.80
5.3.280.0200.05314.60
5.3.270.0130.06014.78
5.3.260.0070.05314.51
5.3.250.0030.06014.70
5.3.240.0170.05014.59
5.3.230.0100.06314.76
5.3.220.0170.04314.64
5.3.210.0230.04014.66
5.3.200.0100.04714.71
5.3.190.0030.05314.55
5.3.180.0100.05014.66
5.3.170.0100.07014.71
5.3.160.0170.05314.65
5.3.150.0030.07714.48
5.3.140.0100.05714.55
5.3.130.0030.06014.45
5.3.120.0030.07314.63
5.3.110.0170.06314.54
5.3.100.0100.06714.18
5.3.90.0130.06314.24
5.3.80.0100.06714.05
5.3.70.0070.05714.11
5.3.60.0100.06714.02
5.3.50.0300.05014.04
5.3.40.0100.04713.93
5.3.30.0070.06713.90
5.3.20.0070.04713.78
5.3.10.0030.05313.83
5.3.00.0030.05313.71
5.2.170.0100.05311.16
5.2.160.0130.03310.98
5.2.150.0100.03711.23
5.2.140.0070.04711.23
5.2.130.0070.04011.27
5.2.120.0100.04311.29
5.2.110.0030.05711.18
5.2.100.0100.05311.08
5.2.90.0070.06011.13
5.2.80.0030.06010.92
5.2.70.0000.04711.18
5.2.60.0100.03710.97
5.2.50.0100.04711.02
5.2.40.0070.05311.23
5.2.30.0070.05711.16
5.2.20.0100.04311.04
5.2.10.0130.04310.77
5.2.00.0130.04010.80
5.1.60.0070.03310.24
5.1.50.0070.03710.07
5.1.40.0100.03310.05
5.1.30.0100.05010.42
5.1.20.0130.03310.45
5.1.10.0070.0439.91
5.1.00.0030.05010.14
5.0.50.0030.0308.71
5.0.40.0000.0308.57
5.0.30.0070.0438.47
5.0.20.0030.0308.26
5.0.10.0030.0338.38
5.0.00.0030.0408.00
4.4.90.0000.0276.76
4.4.80.0070.0176.76
4.4.70.0070.0236.76
4.4.60.0100.0236.76
4.4.50.0030.0236.76
4.4.40.0030.0476.76
4.4.30.0070.0276.76
4.4.20.0070.0236.76
4.4.10.0070.0176.76
4.4.00.0030.0436.76
4.3.110.0000.0336.76
4.3.100.0030.0206.76
4.3.90.0070.0236.76
4.3.80.0030.0476.76
4.3.70.0030.0206.76
4.3.60.0070.0176.76
4.3.50.0030.0276.76
4.3.40.0000.0376.76
4.3.30.0030.0236.76
4.3.20.0070.0176.76
4.3.10.0000.0276.76
4.3.00.0000.01315.57

preferences:
47.64 ms | 401 KiB | 5 Q