3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Bijective { /** * * @var string */ private $dictionary = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; /** * CTOR */ public function __construct() { $this->dictionary = str_split($this->dictionary); } /** * * @param int $i * @return string */ 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); } /** * * @param string $input * @return int */ 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; } } $b=new Bijective();

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.0080.01116.49
8.3.50.0130.00616.68
8.3.40.0120.00318.71
8.3.30.0060.01218.71
8.3.20.0040.00418.74
8.3.10.0030.00620.39
8.3.00.0060.00319.25
8.2.180.0000.02018.16
8.2.170.0090.00622.96
8.2.160.0070.00720.35
8.2.150.0070.00024.18
8.2.140.0050.00324.66
8.2.130.0050.01026.16
8.2.120.0020.00519.76
8.2.110.0070.00420.57
8.2.100.0060.00617.78
8.2.90.0000.00819.05
8.2.80.0060.00317.97
8.2.70.0030.00517.50
8.2.60.0040.00417.93
8.2.50.0030.00618.07
8.2.40.0000.00718.09
8.2.30.0000.00717.91
8.2.20.0070.00017.55
8.2.10.0030.00519.46
8.2.00.0040.00417.55
8.1.280.0140.00025.92
8.1.270.0100.00324.66
8.1.260.0050.00326.35
8.1.250.0080.00028.09
8.1.240.0060.00321.99
8.1.230.0070.00417.52
8.1.220.0080.00017.74
8.1.210.0040.00418.77
8.1.200.0030.00617.23
8.1.190.0000.00717.50
8.1.180.0000.00818.10
8.1.170.0040.00418.79
8.1.160.0000.00818.73
8.1.150.0050.00218.45
8.1.140.0040.00417.36
8.1.130.0040.00417.71
8.1.120.0050.00217.41
8.1.110.0080.00017.42
8.1.100.0000.00717.29
8.1.90.0030.00517.43
8.1.80.0040.00417.41
8.1.70.0000.00717.41
8.1.60.0040.00417.51
8.1.50.0000.00817.40
8.1.40.0000.00817.56
8.1.30.0000.00817.60
8.1.20.0000.00817.60
8.1.10.0050.00217.52
8.1.00.0090.00017.41
8.0.300.0000.00818.77
8.0.290.0080.00016.63
8.0.280.0040.00318.39
8.0.270.0000.00717.19
8.0.260.0060.00016.64
8.0.250.0000.00716.93
8.0.240.0070.00316.93
8.0.230.0000.00716.80
8.0.220.0070.00016.76
8.0.210.0030.00316.72
8.0.200.0030.00316.88
8.0.190.0070.00016.89
8.0.180.0040.00416.88
8.0.170.0090.00016.80
8.0.160.0040.00416.82
8.0.150.0040.00416.68
8.0.140.0000.01016.81
8.0.130.0060.00013.27
8.0.120.0000.00916.78
8.0.110.0000.00716.73
8.0.100.0040.00416.90
8.0.90.0040.00416.71
8.0.80.0060.00916.79
8.0.70.0050.00516.75
8.0.60.0040.00416.95
8.0.50.0050.00216.72
8.0.30.0120.00617.20
8.0.20.0100.01017.05
8.0.10.0050.00317.02
8.0.00.0020.02016.84
7.4.330.0050.00012.99
7.4.320.0030.00316.57
7.4.300.0060.00016.52
7.4.290.0030.00316.41
7.4.280.0080.00016.42
7.4.270.0030.00316.51
7.4.260.0030.00313.19
7.4.250.0000.00716.63
7.4.240.0000.00716.59
7.4.230.0030.00316.68
7.4.220.0100.00616.46
7.4.210.0100.00616.61
7.4.200.0000.00716.61
7.4.190.0000.00716.37
7.4.160.0060.01016.23
7.4.150.0070.01016.57
7.4.140.0070.01016.42
7.4.130.0100.00716.47
7.4.120.0180.00316.47
7.4.110.0120.00916.54
7.4.100.0070.01016.45
7.4.90.0090.00916.53
7.4.80.0000.01516.64
7.4.70.0000.01716.32
7.4.60.0100.00716.39
7.4.50.0000.00816.49
7.4.40.0100.00316.38
7.4.30.0130.00716.27
7.4.00.0110.00514.89
7.3.330.0000.00613.31
7.3.320.0030.00313.29
7.3.310.0040.00416.13
7.3.300.0030.00316.36
7.3.290.0070.00716.25
7.3.280.0100.00916.27
7.3.270.0110.00716.22
7.3.260.0110.00616.35
7.3.250.0150.00816.34
7.3.240.0090.00916.54
7.3.230.0140.00316.26
7.3.210.0120.00416.32
7.3.200.0030.01419.39
7.3.190.0150.00616.38
7.3.180.0160.00016.55
7.3.170.0090.00816.55
7.3.160.0090.00616.16
7.3.120.0080.00914.72
7.3.110.0100.00714.70
7.3.100.0020.01414.61
7.3.90.0010.01114.81
7.3.80.0030.00814.92
7.3.70.0050.00514.63
7.3.60.0060.00914.61
7.3.50.0100.00514.67
7.3.40.0040.00814.54
7.3.30.0090.00514.46
7.3.20.0030.01016.65
7.3.10.0080.00616.43
7.3.00.0090.00616.55
7.2.330.0110.00616.44
7.2.320.0040.01316.43
7.2.310.0090.00916.76
7.2.300.0070.01016.53
7.2.290.0030.01316.54
7.2.250.0090.00815.11
7.2.240.0080.00715.09
7.2.230.0040.01114.99
7.2.220.0040.01314.93
7.2.210.0050.00814.88
7.2.200.0030.01015.14
7.2.190.0080.00614.89
7.2.180.0060.00514.91
7.2.170.0080.00715.00
7.2.130.0100.00316.56
7.2.120.0070.00816.57
7.2.110.0060.00816.79
7.2.100.0070.00716.41
7.2.90.0110.00316.78
7.2.80.0060.00816.73
7.2.70.0070.00816.59
7.2.60.0120.00816.68
7.2.50.0090.01016.84
7.2.40.0100.00216.64
7.2.30.0070.01116.66
7.2.20.0130.00816.65
7.2.10.0110.00916.60
7.2.00.0120.00716.76
7.1.330.0080.00515.51
7.1.320.0090.00615.68
7.1.310.0020.00915.63
7.1.300.0070.00415.65
7.1.290.0070.00515.49
7.1.280.0060.00415.64
7.1.270.0060.00815.72
7.1.260.0030.01015.63
7.1.250.0050.01015.20
7.1.70.0100.00317.10
7.1.60.0070.01819.40
7.1.50.0070.01316.89
7.1.00.0030.06722.44
7.0.200.0000.00716.75
7.0.140.0030.07322.09
7.0.120.0030.06722.08
7.0.60.0170.06319.98
7.0.50.0130.04317.88
7.0.40.0000.05320.05
7.0.30.0300.05320.21
7.0.20.0200.04720.05
7.0.10.0070.05720.12
7.0.00.0000.05020.08
5.6.280.0070.07020.78
5.6.210.0030.04020.69
5.6.200.0070.04318.20
5.6.190.0130.08320.46
5.6.180.0300.08020.51
5.6.170.0330.05020.48
5.6.160.0000.04720.43
5.6.150.0000.06718.21
5.6.140.0130.06018.28
5.6.130.0070.08718.18
5.6.120.0030.05020.99
5.6.110.0000.04320.89
5.6.100.0070.07320.96
5.6.90.0030.07020.98
5.6.80.0070.08020.53
5.5.350.0030.08320.39
5.5.340.0100.07717.97
5.5.330.0030.08320.21
5.5.320.0370.07020.20
5.5.310.0170.05020.41
5.5.300.0030.05017.94
5.5.290.0130.08017.98
5.5.280.0070.04020.81
5.5.270.0100.08020.77
5.5.260.0100.07020.90
5.5.250.0130.07320.62
5.5.240.4300.03320.16
5.4.450.0000.08319.20
5.4.440.0070.09319.27
5.4.430.0070.05319.44
5.4.420.0170.06319.17
5.4.410.0030.04019.31
5.4.400.0070.07019.09
5.4.390.0100.03719.23
5.4.380.0070.07718.87
5.4.370.0030.05719.00
5.4.360.0000.05319.24
5.4.350.0130.07319.20
5.4.340.0070.05019.18
5.4.320.0030.04018.92
5.4.310.0030.04019.15
5.4.300.0070.03718.95
5.4.290.0100.03318.85
5.4.280.0130.03019.09
5.4.270.0100.03318.98
5.4.260.0030.03718.97
5.4.250.0000.04019.16
5.4.240.0100.03319.15
5.4.230.0000.04018.91
5.4.220.0100.06019.14
5.4.210.0070.03719.05
5.4.200.0130.02719.15
5.4.190.0030.04019.25
5.4.180.0000.04019.07
5.4.170.0000.04018.96
5.4.160.0030.03718.85
5.4.150.0000.04019.12
5.4.140.0030.03316.25
5.4.130.0070.03016.54
5.4.120.0070.03016.39
5.4.110.0030.03716.43
5.4.100.0030.03316.45
5.4.90.0030.04016.41
5.4.80.0000.03716.27
5.4.70.0100.02716.39
5.4.60.0000.04016.25
5.4.50.0030.04316.45
5.4.40.0130.03716.43
5.4.30.0130.06016.43
5.4.20.0030.07016.26
5.4.10.0070.04716.41
5.4.00.0100.06715.74
5.3.290.0070.03314.71
5.3.280.0000.04014.66
5.3.270.0070.03314.75
5.3.260.0070.03314.76
5.3.250.0000.04714.53
5.3.240.0030.03314.76
5.3.230.0130.03314.50
5.3.220.0000.04014.62
5.3.210.0030.03714.60
5.3.200.0030.03714.60
5.3.190.0070.03314.63
5.3.180.0130.03014.63
5.3.170.0030.04014.58
5.3.160.0070.03714.65
5.3.150.0000.04314.62
5.3.140.0030.05314.63
5.3.130.0100.03314.45
5.3.120.0030.04714.56
5.3.110.0030.07314.61
5.3.100.0070.05314.14
5.3.90.0030.04713.95
5.3.80.0070.04014.09
5.3.70.0070.04014.18
5.3.60.0030.07714.09
5.3.50.0070.06013.92
5.3.40.0100.07014.00
5.3.30.0070.04713.84
5.3.20.0130.06313.70
5.3.10.0070.05313.82
5.3.00.0030.08013.68
5.2.170.0070.05011.21
5.2.160.0000.04011.32
5.2.150.0000.04011.20
5.2.140.0000.05711.10
5.2.130.0030.04011.18
5.2.120.0100.05711.08
5.2.110.0100.06011.07
5.2.100.0030.04711.16
5.2.90.0070.05311.08
5.2.80.0100.04311.18
5.2.70.0070.03311.06
5.2.60.0100.02711.22
5.2.50.0070.06010.98
5.2.40.0100.06011.06
5.2.30.0030.03710.95
5.2.20.0070.06311.02
5.2.10.0030.03310.89
5.2.00.0070.02310.73
5.1.60.0070.0209.98
5.1.50.0070.0279.96
5.1.40.0000.0339.90
5.1.30.0070.05310.31
5.1.20.0070.05710.52
5.1.10.0030.03710.15
5.1.00.0030.02710.13
5.0.50.0030.0408.71
5.0.40.0030.0378.38
5.0.30.0070.0278.30
5.0.20.0030.0208.30
5.0.10.0030.0408.30
5.0.00.0000.0608.30
4.4.90.0030.0278.30
4.4.80.0000.0308.30
4.4.70.0070.0378.30
4.4.60.0030.0238.30
4.4.50.0100.0108.30
4.4.40.0030.0338.30
4.4.30.0000.0208.30
4.4.20.0070.0238.30
4.4.10.0070.0278.30
4.4.00.0000.0308.30
4.3.110.0000.0208.30
4.3.100.0030.0178.30
4.3.90.0030.0308.30
4.3.80.0000.0308.30
4.3.70.0030.0278.30
4.3.60.0000.0278.30
4.3.50.0070.0308.30
4.3.40.0000.0538.30
4.3.30.0030.0278.30
4.3.20.0030.0308.30
4.3.10.0000.0238.30
4.3.00.0000.0238.30

preferences:
47.19 ms | 401 KiB | 5 Q