3v4l.org

run code in 300+ PHP versions simultaneously
<?php function create_word(string $alphabet, int $index): string { $base = mb_strlen($alphabet); $fix = 1; $length = 1; foreach (range(1, $base) as $k) { $pow = pow($base, $k); if ($fix + $pow <= $index) { $fix += $pow; $length++; } else { break; } } $template = sprintf("%0{$length}d", base_convert($index - $fix, 10, $base)); $replace = implode('', range(0, $base)); return strtr($template, $replace, $alphabet); } for ($i = 1; $i <= 81; $i++) { echo $i . ' = '. create_word("abc", $i) . \PHP_EOL; }

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.70.0070.01118.30
8.3.60.0120.00318.30
8.3.50.0090.00618.35
8.3.40.0090.00618.79
8.3.30.0130.00318.83
8.3.20.0040.00421.91
8.3.10.0040.00421.73
8.3.00.0040.00420.58
8.2.190.0090.00618.55
8.2.180.0100.01016.38
8.2.170.0040.01122.96
8.2.160.0060.00920.88
8.2.150.0000.00724.18
8.2.140.0000.00824.66
8.2.130.0080.00026.16
8.2.120.0040.00426.16
8.2.110.0100.00019.27
8.2.100.0080.00417.72
8.2.90.0090.00018.03
8.2.80.0050.00518.16
8.2.70.0060.00318.04
8.2.60.0040.00418.34
8.2.50.0040.00418.10
8.2.40.0030.00621.09
8.2.30.0040.00419.30
8.2.20.0040.00418.11
8.2.10.0000.00818.98
8.2.00.0040.00419.36
8.1.280.0130.00625.92
8.1.270.0030.00622.08
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0100.00319.01
8.1.230.0120.00021.03
8.1.220.0040.00420.87
8.1.210.0060.00318.77
8.1.200.0030.00617.23
8.1.190.0030.00517.23
8.1.180.0090.00018.10
8.1.170.0060.00318.86
8.1.160.0070.00019.03
8.1.150.0040.00418.94
8.1.140.0020.00518.93
8.1.130.0040.00417.45
8.1.120.0060.00317.44
8.1.110.0000.00817.43
8.1.100.0040.00417.49
8.1.90.0040.00417.47
8.1.80.0080.00017.48
8.1.70.0030.00317.29
8.1.60.0050.00317.65
8.1.50.0030.00717.59
8.1.40.0030.00617.57
8.1.30.0050.00317.64
8.1.20.0030.00517.62
8.1.10.0000.00917.70
8.1.00.0000.00817.56
8.0.300.0040.00419.73
8.0.290.0080.00016.75
8.0.280.0070.00018.61
8.0.270.0030.00617.31
8.0.260.0000.00716.88
8.0.250.0030.00317.00
8.0.240.0000.00716.88
8.0.230.0060.00317.02
8.0.220.0070.00016.91
8.0.210.0040.00416.96
8.0.200.0040.00417.03
8.0.190.0080.00016.93
8.0.180.0000.00717.00
8.0.170.0040.00416.95
8.0.160.0040.00416.85
8.0.150.0070.00016.97
8.0.140.0040.00416.84
8.0.130.0000.00613.44
8.0.120.0070.00016.91
8.0.110.0070.00016.95
8.0.100.0020.00516.91
8.0.90.0040.00416.84
8.0.80.0070.00816.91
8.0.70.0000.00716.91
8.0.60.0000.00916.98
8.0.50.0080.00016.89
8.0.30.0130.00717.13
8.0.20.0030.01616.85
8.0.10.0050.00217.01
8.0.00.0190.00616.67
7.4.330.0040.00015.55
7.4.320.0000.00616.50
7.4.300.0030.00316.63
7.4.290.0070.00016.56
7.4.280.0000.00816.49
7.4.270.0040.00416.40
7.4.260.0030.00313.28
7.4.250.0080.00016.32
7.4.240.0050.00216.44
7.4.230.0030.00316.68
7.4.220.0020.00516.52
7.4.210.0090.00816.60
7.4.200.0040.00416.66
7.4.130.0100.01016.50
7.4.120.0090.01016.48
7.4.110.0090.00916.46
7.4.100.0070.01116.57
7.4.90.0110.00816.66
7.4.80.0100.00719.39
7.4.70.0130.00316.55
7.4.60.0090.00916.70
7.4.50.0080.00416.64
7.4.40.0100.00716.48
7.4.10.0090.00615.02
7.4.00.0050.01115.08
7.3.330.0070.00016.21
7.3.320.0000.00513.36
7.3.310.0000.00716.21
7.3.300.0030.00316.36
7.3.290.0060.01216.35
7.3.280.0060.00916.30
7.3.260.0110.01016.47
7.3.240.0090.00916.52
7.3.230.0160.00616.52
7.3.210.0130.00416.27
7.3.200.0070.01016.37
7.3.190.0110.01116.36
7.3.180.0130.00316.41
7.3.170.0100.00716.38
7.3.160.0130.00316.45
7.3.130.0100.01014.81
7.3.120.0110.00714.81
7.3.110.0090.00914.74
7.3.100.0020.01314.67
7.3.90.0060.00914.83
7.3.80.0100.00314.82
7.3.70.0040.01014.75
7.3.60.0060.00814.89
7.3.50.0070.00714.85
7.3.40.0060.00614.90
7.3.30.0110.00614.88
7.3.20.0030.01016.36
7.3.10.0030.01016.60
7.3.00.0090.00716.57
7.2.330.0070.01316.63
7.2.320.0140.00316.45
7.2.310.0120.01216.80
7.2.300.0090.00916.69
7.2.290.0140.00316.77
7.2.260.0140.00714.93
7.2.250.0030.01714.95
7.2.240.0100.00515.08
7.2.230.0070.01015.19
7.2.220.0050.01215.15
7.2.210.0070.00815.14
7.2.200.0030.00915.17
7.2.190.0030.01115.13
7.2.180.0050.00815.15
7.2.170.0050.01115.06
7.2.160.0060.01114.89
7.2.150.0040.01116.86
7.2.140.0040.01116.93
7.2.130.0020.01316.95
7.2.120.0080.00516.92
7.2.110.0060.00916.81
7.2.100.0050.00916.84
7.2.90.0070.00717.06
7.2.80.0060.00816.81
7.2.70.0030.01017.02
7.2.60.0090.00617.04
7.2.50.0060.01017.10
7.2.40.0060.01016.96
7.2.30.0060.00916.82
7.2.20.0050.01116.97
7.2.10.0110.00516.69
7.2.00.0040.01216.87
7.1.330.0080.00815.84
7.1.320.0100.00715.86
7.1.310.0050.00815.85
7.1.300.0070.00715.77
7.1.290.0020.00915.76
7.1.280.0080.00515.65
7.1.270.0080.00715.84
7.1.260.0080.00315.85
7.1.250.0060.00715.71
7.1.240.0040.01215.71
7.1.230.0090.00615.68
7.1.220.0100.00316.02
7.1.210.0070.00715.89
7.1.200.0030.01415.54
7.1.190.0040.01115.83
7.1.180.0090.00015.95
7.1.170.0030.01315.57
7.1.160.0060.00615.71
7.1.150.0060.00615.46
7.1.140.0030.01115.95
7.1.130.0030.00615.94
7.1.120.0100.00715.57
7.1.110.0030.01315.79
7.1.100.0060.01015.65
7.1.90.0060.00315.74
7.1.80.0070.00316.04
7.1.70.0040.01115.70
7.1.60.0030.01215.96
7.1.50.0030.01315.87
7.1.40.0070.00715.91
7.1.30.0040.01115.87
7.1.20.0060.00315.53
7.1.10.0040.01015.75
7.1.00.0060.00916.01

preferences:
43.44 ms | 401 KiB | 5 Q