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(); echo $b->decode('d5iskrr'); echo '<br />'; echo $b->encode(222742818279); echo '<br />'; echo $b->encode(222742818278);

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.0150.00418.43
8.3.50.0150.00822.00
8.3.40.0000.01519.02
8.3.30.0070.00719.21
8.3.20.0030.00520.11
8.3.10.0080.00023.66
8.3.00.0040.00422.56
8.2.180.0150.00317.00
8.2.170.0120.00622.96
8.2.160.0030.01022.27
8.2.150.0040.00424.18
8.2.140.0050.00324.66
8.2.130.0040.00426.16
8.2.120.0090.00017.88
8.2.110.0090.00022.02
8.2.100.0060.00617.91
8.2.90.0040.00419.17
8.2.80.0000.00817.97
8.2.70.0080.00017.75
8.2.60.0000.01118.05
8.2.50.0000.00918.07
8.2.40.0000.00818.22
8.2.30.0000.00818.25
8.2.20.0000.00717.68
8.2.10.0040.00417.73
8.2.00.0050.00217.74
8.1.280.0110.00425.92
8.1.270.0090.00023.97
8.1.260.0040.00426.35
8.1.250.0000.00828.09
8.1.240.0070.00423.97
8.1.230.0030.00919.10
8.1.220.0050.00317.75
8.1.210.0050.00318.77
8.1.200.0060.00317.35
8.1.190.0030.00517.30
8.1.180.0030.00518.10
8.1.170.0040.00418.50
8.1.160.0040.00421.95
8.1.150.0050.00218.71
8.1.140.0030.00617.36
8.1.130.0040.00417.84
8.1.120.0030.00517.41
8.1.110.0050.00217.50
8.1.100.0050.00217.31
8.1.90.0030.00617.48
8.1.80.0000.00817.40
8.1.70.0030.00517.45
8.1.60.0060.00317.60
8.1.50.0000.00817.43
8.1.40.0070.00017.52
8.1.30.0000.00917.53
8.1.20.0080.00017.56
8.1.10.0000.00817.59
8.1.00.0040.00417.43
8.0.300.0000.00818.77
8.0.290.0050.00217.28
8.0.280.0030.00318.38
8.0.270.0030.00317.39
8.0.260.0050.00316.90
8.0.250.0050.00317.06
8.0.240.0000.00716.91
8.0.230.0000.00717.08
8.0.220.0000.00717.00
8.0.210.0040.00416.99
8.0.200.0030.00316.89
8.0.190.0030.00516.98
8.0.180.0050.00216.96
8.0.170.0000.00816.89
8.0.160.0080.00016.95
8.0.150.0040.00416.89
8.0.140.0000.00716.82
8.0.130.0040.00413.41
8.0.120.0000.00916.94
8.0.110.0040.00417.00
8.0.100.0000.00716.82
8.0.90.0070.00016.95
8.0.80.0100.00716.97
8.0.70.0040.00417.10
8.0.60.0040.00416.88
8.0.50.0030.00517.01
8.0.30.0080.01117.04
8.0.20.0080.01317.40
8.0.10.0040.00417.13
8.0.00.0110.01416.82
7.4.330.0050.00015.00
7.4.320.0040.00416.63
7.4.300.0030.00316.51
7.4.290.0030.00316.63
7.4.280.0030.00316.58
7.4.270.0030.00316.51
7.4.260.0030.00316.60
7.4.250.0070.00016.49
7.4.240.0060.00116.52
7.4.230.0070.00016.41
7.4.220.0120.00616.64
7.4.210.0080.00616.63
7.4.200.0050.00216.71
7.4.190.0030.00316.78
7.4.160.0120.00816.54
7.4.150.0130.00617.40
7.4.140.0120.00617.86
7.4.130.0070.01016.63
7.4.120.0160.00116.58
7.4.110.0080.01116.46
7.4.100.0090.00916.62
7.4.90.0100.00716.54
7.4.80.0120.00916.49
7.4.70.0070.01016.63
7.4.60.0120.00816.55
7.4.50.0050.00016.42
7.4.40.0090.00922.77
7.4.30.0090.00916.66
7.4.00.0100.00714.93
7.3.330.0020.00213.32
7.3.320.0060.00013.43
7.3.310.0030.00316.46
7.3.300.0030.00316.44
7.3.290.0030.01016.45
7.3.280.0070.01116.44
7.3.270.0110.00617.40
7.3.260.0070.01616.64
7.3.250.0090.00716.50
7.3.240.0100.00716.63
7.3.230.0070.01016.42
7.3.210.0120.00616.50
7.3.200.0070.01719.39
7.3.190.0110.00616.58
7.3.180.0100.00716.34
7.3.170.0080.00816.43
7.3.160.0030.01216.53
7.3.120.0030.01414.96
7.3.110.0070.01014.96
7.3.100.0030.01414.82
7.3.90.0000.00914.64
7.3.80.0120.00315.16
7.3.70.0030.01014.97
7.3.60.0030.01014.98
7.3.50.0070.01014.82
7.3.40.0030.00614.94
7.3.30.0090.00314.91
7.3.20.0070.00616.63
7.3.10.0120.00016.70
7.3.00.0050.00916.65
7.2.330.0140.00316.70
7.2.320.0100.00716.45
7.2.310.0100.01016.75
7.2.300.0090.00816.73
7.2.290.0100.00616.86
7.2.250.0120.00315.23
7.2.240.0000.02014.75
7.2.230.0120.00315.09
7.2.220.0040.01115.38
7.2.210.0040.01415.31
7.2.200.0040.00715.29
7.2.190.0060.01015.29
7.2.180.0030.00615.17
7.2.170.0090.00315.29
7.2.130.0060.00617.04
7.2.120.0080.00416.91
7.2.110.0080.00816.89
7.2.100.0080.00417.03
7.2.90.0070.00416.70
7.2.80.0060.00316.95
7.2.70.0090.00616.98
7.2.60.0070.00616.84
7.2.50.0060.00617.07
7.2.40.0030.00916.82
7.2.30.0070.00317.20
7.2.20.0030.00616.82
7.2.10.0110.00416.80
7.2.00.0020.00818.28
7.1.330.0070.00715.81
7.1.320.0090.00616.01
7.1.310.0060.01016.02
7.1.300.0060.00616.02
7.1.290.0040.00415.89
7.1.280.0070.00315.70
7.1.270.0030.01215.80
7.1.260.0070.00316.02
7.1.250.0030.01015.87
7.1.240.0070.00715.94
7.1.230.0060.00315.49
7.1.220.0070.00715.77
7.1.210.0040.01115.59
7.1.200.0050.00615.74
7.1.190.0060.00615.61
7.1.180.0000.01215.70
7.1.170.0000.01015.80
7.1.160.0040.01115.94
7.1.150.0090.00016.02
7.1.140.0060.00915.63
7.1.130.0000.01415.94
7.1.120.0070.00315.98
7.1.110.0000.01015.47
7.1.100.0040.00716.97
7.1.90.0000.01615.87
7.1.80.0060.00615.79
7.1.70.0020.01316.32
7.1.60.0090.00817.57
7.1.50.0050.00716.32
7.1.40.0000.01415.96
7.1.30.0100.00015.56
7.1.20.0070.00715.52
7.1.10.0000.01315.74
7.1.00.0060.04018.97
7.0.330.0000.01415.23
7.0.320.0000.01415.32
7.0.310.0040.00415.55
7.0.300.0030.01015.19
7.0.290.0100.00315.30
7.0.280.0000.01215.53
7.0.270.0000.01015.63
7.0.260.0080.00415.35
7.0.250.0090.00615.53
7.0.240.0080.00015.53
7.0.230.0070.00315.10
7.0.220.0080.00315.55
7.0.210.0030.00715.65
7.0.200.0080.00716.25
7.0.190.0040.00415.61
7.0.180.0100.00315.18
7.0.170.0030.00915.46
7.0.160.0090.00615.52
7.0.150.0000.01215.44
7.0.140.0060.04018.82
7.0.130.0000.01215.59
7.0.120.0030.00915.27
7.0.110.0090.00615.36
7.0.100.0200.02717.76
7.0.90.0120.05117.70
7.0.80.0210.04017.68
7.0.70.0000.03017.65
7.0.60.0110.03917.72
7.0.50.0160.03817.96
7.0.40.0110.04516.88
7.0.30.0050.04216.81
7.0.20.0150.03816.77
7.0.10.0090.04116.70
7.0.00.0080.02516.78
5.6.380.0060.01014.61
5.6.370.0060.00914.67
5.6.360.0060.00314.36
5.6.350.0040.00714.59
5.6.340.0030.01014.34
5.6.330.0000.01314.59
5.6.320.0000.01314.62
5.6.310.0090.00014.46
5.6.300.0040.00414.42
5.6.290.0040.00814.04
5.6.280.0040.04017.61
5.6.270.0030.01014.29
5.6.260.0060.00614.55
5.6.250.0050.04417.56
5.6.240.0030.04817.52
5.6.230.0040.03817.48
5.6.220.0050.04617.47
5.6.210.0090.03817.50
5.6.200.0100.04217.83
5.6.190.0030.04217.80
5.6.180.0150.03517.66
5.6.170.0080.04317.79
5.6.160.0130.04017.90
5.6.150.0060.04617.78
5.6.140.0110.04017.90
5.6.130.0070.04617.87
5.6.120.0110.04017.66
5.6.110.0100.03817.69
5.6.100.0070.03017.70
5.6.90.0080.03517.73
5.6.80.0080.04417.39
5.6.70.0070.03617.50
5.6.60.0080.02717.40
5.6.50.0060.02317.21
5.6.40.0060.02617.40
5.6.30.0040.02617.49
5.6.20.0020.04717.37
5.6.10.0070.03817.21
5.6.00.0090.04217.41
5.5.380.0080.03315.82
5.5.370.0100.03315.78
5.5.360.0110.03515.90
5.5.350.0090.04015.91
5.5.340.0060.04616.19
5.5.330.0070.04016.04
5.5.320.0070.04516.22
5.5.310.0070.02916.04
5.5.300.0070.03916.03
5.5.290.0060.04516.15
5.5.280.0130.04016.20
5.5.270.0030.03016.18
5.5.260.0090.03916.04
5.5.250.0080.02715.89
5.5.240.0120.03215.72
5.5.230.0020.03215.68
5.5.220.0080.02215.67
5.5.210.0030.02515.71
5.5.200.0050.03415.65
5.5.190.0050.02315.74
5.5.180.0050.02315.65
5.5.170.0040.00711.32
5.5.160.0140.03515.71
5.5.150.0120.01715.68
5.5.140.0080.02915.71
5.5.130.0160.03315.76
5.5.120.0140.03515.81
5.5.110.0080.02715.67
5.5.100.0050.03615.58
5.5.90.0030.02515.68
5.5.80.0030.03615.63
5.5.70.0060.03815.62
5.5.60.0000.02615.62
5.5.50.0050.03215.72
5.5.40.0020.03315.65
5.5.30.0060.04115.63
5.5.20.0080.03615.63
5.5.10.0080.03815.63
5.5.00.0050.03715.59
5.4.450.0070.03815.43
5.4.440.0130.03815.26
5.4.430.0030.02515.43
5.4.420.0070.04215.34
5.4.410.0050.03815.17
5.4.400.0030.03515.22
5.4.390.0080.04015.01
5.4.380.0050.02515.27
5.4.370.0050.03015.15
5.4.360.0100.03715.04
5.4.350.0040.02515.14
5.4.340.0030.03315.16
5.4.330.0030.01011.33
5.4.320.0080.04015.15
5.4.310.0060.04215.20
5.4.300.0020.03415.13
5.4.290.0110.03615.19
5.4.280.0030.04015.07
5.4.270.0090.03515.01
5.4.260.0050.02715.05
5.4.250.0000.02715.10
5.4.240.0080.03715.25
5.4.230.0060.03915.01
5.4.220.0070.03715.21
5.4.210.0060.02315.04
5.4.200.0050.02115.11
5.4.190.0070.04215.10
5.4.180.0080.03615.17
5.4.170.0070.04015.05
5.4.160.0030.04315.21
5.4.150.0050.04215.04
5.4.140.0060.04213.71
5.4.130.0060.02413.99
5.4.120.0090.03213.84
5.4.110.0030.03013.80
5.4.100.0100.03913.78
5.4.90.0050.03413.84
5.4.80.0020.04213.78
5.4.70.0070.02513.86
5.4.60.0030.03813.75
5.4.50.0080.03813.80
5.4.40.0050.04013.88
5.4.30.0080.03713.76
5.4.20.0050.02813.75
5.4.10.0060.03613.85
5.4.00.0050.02013.60
5.3.290.0020.04212.98
5.3.280.0060.04112.88
5.3.270.0080.03612.95
5.3.260.0090.01512.95
5.3.250.0070.03812.89
5.3.240.0050.02012.93
5.3.230.0030.02012.91
5.3.220.0040.03912.93
5.3.210.0060.03412.87
5.3.200.0070.03212.86
5.3.190.0100.03212.95
5.3.180.0050.02012.90
5.3.170.0060.03012.87
5.3.160.0030.02012.88
5.3.150.0070.04012.95
5.3.140.0050.03012.88
5.3.130.0080.03612.85
5.3.120.0070.03312.90
5.3.110.0000.02812.83
5.3.100.0030.02112.63
5.3.90.0050.04112.65
5.3.80.0120.03812.66
5.3.70.0070.04012.62
5.3.60.0030.03312.63
5.3.50.0030.04412.56
5.3.40.0010.04112.62
5.3.30.0000.03312.54
5.3.20.0030.03812.46
5.3.10.0040.02612.44
5.3.00.0070.02812.38
5.2.170.0050.03212.32
5.2.160.0030.03412.32
5.2.150.0070.01312.32
5.2.140.0030.02912.32
5.2.130.0030.03112.32
5.2.120.0050.02012.32
5.2.110.0030.01912.32
5.2.100.0050.02312.32
5.2.90.0050.02512.32
5.2.80.0030.02012.32
5.2.70.0040.03212.32
5.2.60.0080.02312.32
5.2.50.0030.03312.32
5.2.40.0040.02912.32
5.2.30.0030.01712.32
5.2.20.0060.02512.32
5.2.10.0050.01812.32
5.2.00.0020.01712.32
5.1.60.0010.01612.32
5.1.50.0000.03412.32
5.1.40.0060.02812.32
5.1.30.0020.03212.32
5.1.20.0050.03012.32
5.1.10.0060.01912.32
5.1.00.0040.02812.32
5.0.50.0030.02612.32
5.0.40.0070.02112.32
5.0.30.0040.03512.32
5.0.20.0050.02412.32
5.0.10.0000.01412.32
5.0.00.0010.03412.32
4.4.90.0040.01712.32
4.4.80.0030.01212.32
4.4.70.0030.01512.32
4.4.60.0030.01712.32
4.4.50.0020.01512.32
4.4.40.0020.01412.32
4.4.30.0000.01612.32
4.4.20.0000.01712.32
4.4.10.0020.02212.32
4.4.00.0050.02712.32
4.3.110.0000.02112.32
4.3.100.0030.01912.32
4.3.90.0030.01012.32
4.3.80.0030.02712.32
4.3.70.0040.01712.32
4.3.60.0050.01212.32
4.3.50.0020.01912.32
4.3.40.0050.01812.32
4.3.30.0040.01512.32
4.3.20.0000.01212.32
4.3.10.0080.01312.32
4.3.00.0050.00812.32

preferences:
47.47 ms | 401 KiB | 5 Q