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.0140.00018.43
8.3.50.0110.00622.04
8.3.40.0110.00718.80
8.3.30.0060.00919.01
8.3.20.0040.00420.33
8.3.10.0080.00023.67
8.3.00.0030.00719.15
8.2.180.0140.00416.63
8.2.170.0090.01222.96
8.2.160.0100.00720.52
8.2.150.0050.00324.18
8.2.140.0040.00424.66
8.2.130.0060.00326.16
8.2.120.0080.00022.05
8.2.110.0040.00420.38
8.2.100.0040.00817.72
8.2.90.0040.00418.84
8.2.80.0000.00817.97
8.2.70.0060.00317.63
8.2.60.0050.00317.80
8.2.50.0030.00518.07
8.2.40.0060.00318.22
8.2.30.0030.00618.04
8.2.20.0040.00417.69
8.2.10.0080.00019.79
8.2.00.0030.00817.54
8.1.280.0090.00625.92
8.1.270.0060.00322.07
8.1.260.0090.00026.35
8.1.250.0080.00028.09
8.1.240.0060.00323.91
8.1.230.0110.00017.42
8.1.220.0000.00817.74
8.1.210.0000.00818.77
8.1.200.0050.00517.35
8.1.190.0080.00017.23
8.1.180.0000.00818.10
8.1.170.0000.00818.53
8.1.160.0050.00221.86
8.1.150.0030.00618.46
8.1.140.0040.00417.39
8.1.130.0030.00317.82
8.1.120.0030.00317.39
8.1.110.0040.00417.30
8.1.100.0030.00317.27
8.1.90.0080.00317.39
8.1.80.0000.00717.43
8.1.70.0070.00017.32
8.1.60.0080.00017.55
8.1.50.0000.00817.44
8.1.40.0050.00217.55
8.1.30.0030.00517.62
8.1.20.0060.00317.61
8.1.10.0070.00017.51
8.1.00.0020.00517.46
8.0.300.0040.00418.77
8.0.290.0000.00816.58
8.0.280.0030.00318.33
8.0.270.0030.00317.07
8.0.260.0000.00717.23
8.0.250.0030.00316.78
8.0.240.0040.00416.88
8.0.230.0070.00016.86
8.0.220.0070.00016.82
8.0.210.0030.00316.74
8.0.200.0060.00016.83
8.0.190.0050.00316.91
8.0.180.0000.00716.82
8.0.170.0000.00716.87
8.0.160.0040.00416.90
8.0.150.0040.00416.79
8.0.140.0000.00716.80
8.0.130.0000.00613.26
8.0.120.0070.00016.78
8.0.110.0020.00516.74
8.0.100.0000.00716.73
8.0.90.0000.00716.95
8.0.80.0030.01116.79
8.0.70.0070.00016.66
8.0.60.0040.00316.79
8.0.50.0040.00416.68
8.0.30.0080.01116.83
8.0.20.0090.01017.40
8.0.10.0080.00016.90
8.0.00.0090.00816.59
7.4.330.0000.00515.00
7.4.320.0000.00616.46
7.4.300.0030.00316.50
7.4.290.0030.00316.42
7.4.280.0000.00716.58
7.4.270.0040.00416.53
7.4.260.0070.00016.49
7.4.250.0050.00316.57
7.4.240.0020.00516.54
7.4.230.0040.00416.60
7.4.220.0110.00716.62
7.4.210.0090.00716.63
7.4.200.0070.00016.41
7.4.190.0030.00316.60
7.4.160.0070.00716.53
7.4.150.0120.00617.40
7.4.140.0080.00817.86
7.4.130.0080.00816.44
7.4.120.0040.01216.55
7.4.110.0070.01016.42
7.4.100.0110.01116.45
7.4.90.0080.01616.51
7.4.80.0130.01019.39
7.4.70.0090.00616.61
7.4.60.0070.01116.58
7.4.50.0030.00616.27
7.4.40.0040.01122.77
7.4.30.0120.00616.52
7.4.00.0030.01014.84
7.3.330.0030.00313.32
7.3.320.0000.00613.23
7.3.310.0040.00416.37
7.3.300.0000.00716.35
7.3.290.0110.00316.31
7.3.280.0050.01416.29
7.3.270.0120.00617.40
7.3.260.0150.00316.21
7.3.250.0120.00616.39
7.3.240.0110.01116.19
7.3.230.0110.00716.39
7.3.210.0080.01116.56
7.3.200.0100.01019.39
7.3.190.0140.00316.21
7.3.180.0100.00716.46
7.3.170.0080.00816.39
7.3.160.0040.01516.22
7.3.120.0090.00314.81
7.2.330.0140.00316.74
7.2.320.0090.00916.39
7.2.310.0030.01416.65
7.2.300.0090.00916.60
7.2.290.0150.00316.34
7.2.60.0110.00316.92
7.2.00.0000.01219.54
7.1.200.0000.01315.63
7.1.100.0040.00418.11
7.1.70.0030.00617.13
7.1.60.0180.00319.33
7.1.50.0100.00716.84
7.1.00.0070.07322.54
7.0.200.0040.01116.73
7.0.140.0070.06322.18
7.0.60.0000.06320.04
7.0.50.0030.05317.86
7.0.40.0070.04020.02
7.0.30.0400.05320.09
7.0.20.0400.06720.07
7.0.10.0030.09020.09
7.0.00.0100.08020.25
5.6.280.0030.09020.83
5.6.210.0130.06720.54
5.6.200.0130.06718.19
5.6.190.0000.05720.41
5.6.180.0230.04320.77
5.6.170.0270.06020.69
5.6.160.0100.08320.55
5.6.150.0100.07318.13
5.6.140.0100.07718.24
5.6.130.0100.08018.11
5.6.120.0070.08721.13
5.6.110.0070.04021.00
5.6.100.0100.03721.12
5.6.90.0130.08021.11
5.6.80.0130.07320.53
5.5.350.0270.06020.41
5.5.340.0130.08017.98
5.5.330.0030.06720.41
5.5.320.0100.07320.19
5.5.310.0170.04720.41
5.5.300.0000.05318.04
5.5.290.0100.07717.98
5.5.280.0070.04020.88
5.5.270.0130.07720.80
5.5.260.0100.08020.80
5.5.250.0070.06720.60
5.5.240.2670.02720.05
5.4.450.0300.05319.31
5.4.440.0170.05019.18
5.4.430.0400.06319.57
5.4.420.0300.07019.56
5.4.410.0330.06719.53
5.4.400.0300.06319.20
5.4.390.0230.04719.00
5.4.380.0270.06319.14
5.4.370.0270.06319.09
5.4.360.0270.04319.06
5.4.350.0330.06319.20
5.4.340.0370.06319.20
5.4.320.0300.06319.26
5.4.310.0270.03319.22
5.4.300.0330.04719.07
5.4.290.0430.06318.95
5.4.280.0370.04019.22
5.4.270.0370.06318.94
5.4.260.0370.06019.16
5.4.250.0370.05719.05
5.4.240.0270.03318.86
5.4.230.0370.06319.07
5.4.220.0330.03319.19
5.4.210.0370.04019.09
5.4.200.0300.04018.84
5.4.190.0270.03019.07
5.4.180.0230.04318.97
5.4.170.0130.04319.07
5.4.160.0170.03719.18
5.4.150.0130.04018.85
5.4.140.0200.03316.38
5.4.130.0230.03016.28
5.4.120.0230.03316.35
5.4.110.0170.03716.45
5.4.100.0170.04016.59
5.4.90.0230.04016.37
5.4.80.0230.03016.25
5.4.70.0200.03716.35
5.4.60.0200.03316.54
5.4.50.0200.03316.17
5.4.40.0300.03316.58
5.4.30.0230.03016.32
5.4.20.0270.02716.57
5.4.10.0170.03316.42
5.4.00.0170.03315.95
5.3.290.0330.05714.59
5.3.280.0330.06714.69
5.3.270.0230.03314.63
5.3.260.0200.03714.66
5.3.250.0200.03314.59
5.3.240.0100.04014.78
5.3.230.0270.03314.60
5.3.220.0200.04714.66
5.3.210.0230.03014.58
5.3.200.0230.03014.66
5.3.190.0170.04314.48
5.3.180.0130.04014.59
5.3.170.0170.03714.69
5.3.160.0100.04314.51
5.3.150.0100.05014.49
5.3.140.0170.04014.72
5.3.130.0170.03714.58
5.3.120.0270.02714.63
5.3.110.0200.04314.68
5.3.100.0130.04014.05
5.3.90.0170.03713.96
5.3.80.0230.03013.95
5.3.70.0200.03314.21
5.3.60.0100.04313.91
5.3.50.0200.03014.00
5.3.40.0170.03313.88
5.3.30.0130.04014.04
5.3.20.0230.03713.75
5.3.10.0330.04313.89
5.3.00.0300.06013.77
5.2.170.0130.03012.05
5.2.160.0100.03012.05
5.2.150.0200.03012.05
5.2.140.0130.03012.05
5.2.130.0200.05712.05
5.2.120.0200.03712.05
5.2.110.0170.04012.05
5.2.100.0130.03312.05
5.2.90.0270.04712.05
5.2.80.0230.03712.05
5.2.70.0170.04012.05
5.2.60.0170.03312.05
5.2.50.0200.06012.05
5.2.40.0170.04712.05
5.2.30.0200.05712.05
5.2.20.0200.04712.05
5.2.10.0230.04312.05
5.2.00.0170.04712.05
5.1.60.0200.03012.05
5.1.50.0130.05712.05
5.1.40.0300.02012.05
5.1.30.0270.05012.05
5.1.20.0230.05012.05
5.1.10.0200.04012.05
5.1.00.0170.05312.05
5.0.50.0070.04712.05
5.0.40.0100.04312.05
5.0.30.0130.03312.05
5.0.20.0130.03712.05
5.0.10.0130.01712.05
5.0.00.0170.05012.05
4.4.90.0070.01712.05
4.4.80.0070.03712.05
4.4.70.0130.02012.05
4.4.60.0070.03012.05
4.4.50.0070.03712.05
4.4.40.0130.05012.05
4.4.30.0070.02312.05
4.4.20.0100.02312.05
4.4.10.0070.02712.05
4.4.00.0100.05012.05
4.3.110.0070.02712.05
4.3.100.0070.03712.05
4.3.90.0130.03012.05
4.3.80.0130.05312.05
4.3.70.0100.02712.05
4.3.60.0100.03312.05
4.3.50.0100.03712.05
4.3.40.0130.04312.05
4.3.30.0030.02712.05
4.3.20.0070.02012.05
4.3.10.0100.02712.05
4.3.00.0070.03012.05

preferences:
63.07 ms | 401 KiB | 5 Q