3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo alphaID('B3333V', true, 6, '3gmgkvj0jw8hrkcnu'); function alphaID($in, $to_num = false, $pad_up = false, $pass_key = null) { $out = ''; $index = 'abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'; $base = strlen($index); if ($pass_key !== null) { // Although this function's purpose is to just make the // ID short - and not so much secure, // with this patch by Simon Franz (http://blog.snaky.org/) // you can optionally supply a password to make it harder // to calculate the corresponding numeric ID $i = str_split($index); $pass_hash = hash('sha256',$pass_key); $pass_hash = (strlen($pass_hash) < strlen($index) ? hash('sha512', $pass_key) : $pass_hash); $pass_hash = substr($pass_hash, 0, strlen($index)); $p = str_split($pass_hash); array_multisort($p, SORT_DESC, $i); $index = implode($i); } if ($to_num) { // Digital number <<-- alphabet letter code $len = strlen($in) - 1; for ($t = $len; $t >= 0; $t--) { $bcp = bcpow($base, $len - $t); $out = $out + strpos($index, substr($in, $t, 1)) * $bcp; } if (is_numeric($pad_up)) { $pad_up--; if ($pad_up > 0) { $out -= pow($base, $pad_up); } } } else { // Digital number -->> alphabet letter code if (is_numeric($pad_up)) { $pad_up--; if ($pad_up > 0) { $in += pow($base, $pad_up); } } for ($t = ($in != 0 ? floor(log($in, $base)) : 0); $t >= 0; $t--) { $bcp = bcpow($base, $t); $a = floor($in / $bcp) % $base; $out = $out . substr($index, $a, 1); $in = $in - ($a * $bcp); } } return $out; }

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.0070.01418.33
8.3.50.0100.01018.13
8.3.40.0090.00618.92
8.3.30.0090.00618.78
8.3.20.0070.00020.28
8.3.10.0040.00418.82
8.3.00.0000.00820.42
8.2.180.0090.00617.00
8.2.170.0090.00622.96
8.2.160.0070.00722.01
8.2.150.0110.00724.18
8.2.140.0090.00024.66
8.2.130.0000.00820.43
8.2.120.0060.00326.35
8.2.110.0030.00719.13
8.2.100.0060.00617.84
8.2.90.0040.00419.23
8.2.80.0030.00517.97
8.2.70.0000.00817.63
8.2.60.0060.00318.04
8.2.50.0040.00418.10
8.2.40.0030.00620.53
8.2.30.0040.00419.51
8.2.20.0030.00617.68
8.2.10.0040.00418.11
8.2.00.0070.00018.23
8.1.280.0040.01125.92
8.1.270.0050.00323.96
8.1.260.0050.00328.09
8.1.250.0060.00328.09
8.1.240.0090.00023.92
8.1.230.0130.00317.70
8.1.220.0040.00417.74
8.1.210.0000.00818.77
8.1.200.0040.00417.46
8.1.190.0040.00417.48
8.1.180.0050.00318.10
8.1.170.0000.00818.59
8.1.160.0040.00420.71
8.1.150.0030.00618.88
8.1.140.0090.00019.54
8.1.130.0040.00417.61
8.1.120.0000.00717.32
8.1.110.0040.00417.36
8.1.100.0040.00317.48
8.1.90.0080.00017.49
8.1.80.0000.00717.34
8.1.70.0040.00417.47
8.1.60.0040.00417.54
8.1.50.0000.00817.54
8.1.40.0040.00417.61
8.1.30.0000.00817.72
8.1.20.0040.00417.73
8.1.10.0040.00417.52
8.1.00.0060.00317.45
8.0.300.0000.00818.77
8.0.290.0000.00816.75
8.0.280.0040.00418.41
8.0.270.0040.00417.23
8.0.260.0000.00817.33
8.0.250.0030.00316.96
8.0.240.0030.00316.95
8.0.230.0000.00717.05
8.0.220.0000.00816.84
8.0.210.0030.00316.88
8.0.200.0030.00316.99
8.0.190.0040.00417.03
8.0.180.0070.00416.98
8.0.170.0000.00816.95
8.0.160.0000.00716.91
8.0.150.0000.00816.87
8.0.140.0050.00216.86
8.0.130.0030.00513.39
8.0.120.0040.00416.87
8.0.110.0070.00016.92
8.0.100.0040.00416.95
8.0.90.0000.00716.73
8.0.80.0080.00716.91
8.0.70.0070.00016.85
8.0.60.0040.00417.02
8.0.50.0000.00816.86
8.0.30.0060.01117.11
8.0.20.0100.00917.40
8.0.10.0050.00217.10
8.0.00.0070.01117.02
7.4.330.0050.00016.84
7.4.320.0030.00316.64
7.4.300.0000.00616.52
7.4.290.0070.00416.46
7.4.280.0000.00916.46
7.4.270.0000.00716.57
7.4.260.0040.00416.63
7.4.250.0000.00716.62
7.4.240.0030.00516.57
7.4.230.0000.00716.66
7.4.220.0110.00716.53
7.4.210.0070.00716.70
7.4.200.0070.00016.56
7.4.160.0080.00816.65
7.4.150.0090.01217.40
7.4.140.0060.01117.86
7.4.130.0160.00416.68
7.4.120.0140.00316.59
7.4.110.0100.00716.63
7.4.100.0060.01016.60
7.4.90.0100.00716.48
7.4.80.0150.01619.39
7.4.70.0060.01016.57
7.4.60.0110.00616.66
7.4.50.0040.01116.65
7.4.40.0100.00716.57
7.4.30.0100.00716.56
7.4.00.0060.00914.96
7.3.330.0000.00613.29
7.3.320.0050.00013.45
7.3.310.0030.00316.48
7.3.300.0040.00416.44
7.3.290.0080.00816.48
7.3.280.0100.01016.45
7.3.270.0140.00317.40
7.3.260.0110.01116.36
7.3.250.0090.01116.42
7.3.240.0080.00916.66
7.3.230.0100.01016.39
7.3.210.0100.00616.56
7.3.200.0110.01116.61
7.3.190.0120.00316.40
7.3.180.0100.00716.57
7.3.170.0160.00016.48
7.3.160.0060.01616.48
7.3.10.0150.00316.32
7.3.00.0150.00316.33
7.2.330.0030.01316.50
7.2.320.0160.00316.45
7.2.310.0100.00716.72
7.2.300.0070.01016.61
7.2.290.0060.00916.64
7.2.130.0150.00616.78
7.2.120.0150.00616.59
7.2.110.0150.00316.96
7.2.100.0070.01316.96
7.2.90.0100.00716.96
7.2.80.0130.00316.94
7.2.70.0070.01016.88
7.2.60.0160.00716.77
7.2.50.0080.00916.84
7.2.40.0140.00316.76
7.2.30.0100.01016.55
7.2.20.0140.00416.97
7.2.10.0070.01316.47
7.2.00.0090.00518.28
7.1.250.0120.00915.62
7.1.240.0100.01015.77
7.1.230.0130.00615.62
7.1.220.0100.00315.53
7.1.210.0070.00715.77
7.1.200.0080.00715.77
7.1.190.0160.00315.71
7.1.180.0070.00715.45
7.1.170.0130.00715.62
7.1.160.0130.00615.59
7.1.150.0130.00915.79
7.1.140.0070.01015.66
7.1.130.0140.00415.46
7.1.120.0110.00415.77
7.1.110.0080.00515.63
7.1.100.0120.00615.71
7.1.90.0140.00315.54
7.1.80.0140.00315.66
7.1.70.0030.01016.54
7.1.60.0120.00817.45
7.1.50.0100.00716.19
7.1.40.0060.00915.93
7.1.30.0070.01115.64
7.1.20.0060.00915.83
7.1.10.0140.00615.89
7.1.00.0020.04719.02
7.0.330.0110.00615.14
7.0.320.0130.00715.12
7.0.310.0090.00915.36
7.0.300.0120.00315.41
7.0.290.0070.01115.15
7.0.280.0100.00715.30
7.0.270.0090.00315.25
7.0.260.0100.00715.21
7.0.250.0060.00915.35
7.0.240.0090.00915.54
7.0.230.0140.01115.17
7.0.220.0070.01115.15
7.0.210.0100.00615.41
7.0.200.0030.00916.08
7.0.190.0070.01314.97
7.0.180.0100.01015.26
7.0.170.0120.00615.27
7.0.160.0070.00715.49
7.0.150.0100.00715.27
7.0.140.0100.00615.20
7.0.130.0140.00315.31
7.0.120.0130.00615.22
7.0.110.0170.00315.50
7.0.100.0130.01015.26
7.0.90.0110.01115.29
7.0.80.0140.00315.32
7.0.70.0080.00814.95
7.0.60.0220.03618.69
7.0.50.0090.02716.63
7.0.40.0070.04716.57
7.0.30.0120.02816.79
7.0.20.0100.02716.62
7.0.10.0050.02716.79
7.0.00.0030.03616.65
5.6.380.0110.00014.64
5.6.370.0100.01714.73
5.6.360.0120.00814.72
5.6.350.0110.00614.11
5.6.340.0000.02014.06
5.6.330.0030.01314.12
5.6.320.0110.00713.89
5.6.310.0100.00713.79
5.6.300.0070.01414.50
5.6.290.0130.00914.29
5.6.280.0110.04017.78
5.6.270.0130.00714.51
5.6.260.0150.00314.11
5.6.250.0160.00914.38
5.6.240.0060.01614.15
5.6.230.0100.01114.57
5.6.220.0090.01414.39
5.6.210.0160.03917.60
5.6.200.0160.02316.41
5.6.190.0140.04017.43
5.6.180.0130.03317.69
5.6.170.0280.04017.60
5.6.160.0110.02917.61
5.6.150.0120.02816.27
5.6.140.0060.02316.24
5.6.130.0030.04016.30
5.6.120.0090.03717.63
5.6.110.0060.04717.43
5.6.100.0080.04417.59
5.6.90.0050.03017.63
5.6.80.0060.03717.38
5.6.70.0030.01014.63
5.6.60.0030.00714.25
5.6.50.0000.01414.26
5.6.40.0080.00514.00
5.6.30.0070.00714.24
5.6.20.0000.01114.40
5.6.10.0080.00813.89
5.6.00.0120.00314.17
5.5.380.0100.01010.93
5.5.370.0170.00010.93
5.5.360.0130.00710.86
5.5.350.0200.04015.79
5.5.340.0130.03814.57
5.5.330.0070.02516.04
5.5.320.0150.02615.62
5.5.310.0190.03915.63
5.5.300.0110.03714.51
5.5.290.0080.03714.62
5.5.280.0100.02715.81
5.5.270.0020.02615.71
5.5.260.0080.04015.82
5.5.250.0150.02715.67
5.5.240.0150.02815.72
5.5.230.0000.01110.98
5.5.220.0030.00910.81
5.5.210.0030.00311.04
5.5.200.0040.00810.82
5.5.190.0070.00011.09
5.5.180.0100.00010.87
5.5.170.0080.00310.91
5.5.160.0030.00911.18
5.5.150.0060.00910.62
5.5.140.0090.00310.45
5.5.130.0090.00311.02
5.5.120.0060.00610.99
5.5.110.0030.00910.96
5.5.100.0000.01311.07
5.5.90.0070.00410.41
5.5.80.0060.00610.98
5.5.70.0030.00311.10
5.5.60.0000.01110.81
5.5.50.0030.01010.70
5.5.40.0060.00610.86
5.5.30.0000.01010.48
5.5.20.0070.00411.09
5.5.10.0070.00311.10
5.5.00.0060.00610.80

preferences:
53.6 ms | 400 KiB | 5 Q