3v4l.org

run code in 300+ PHP versions simultaneously
<?php function password($len = 12) { $chars = 'abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'; $len = strlen($chars); $cutoff = floor(256 / $len) * $len; for (;;) { $byte = ord(openssl_random_pseudo_bytes(1)[0]); if ($byte >= $cutoff) { continue; } return $byte % $len; } } echo password();

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.0080.00818.18
8.3.60.0210.00016.63
8.3.50.0100.00817.22
8.3.40.0070.00718.79
8.3.30.0000.01518.61
8.3.20.0040.00420.41
8.3.10.0070.00321.85
8.3.00.0040.00422.05
8.2.180.0070.00716.50
8.2.170.0070.00722.96
8.2.160.0090.00619.24
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0090.00021.00
8.2.120.0080.00026.35
8.2.110.0090.00021.06
8.2.100.0080.00317.86
8.2.90.0000.00819.22
8.2.80.0060.00317.97
8.2.70.0040.00417.50
8.2.60.0030.00617.93
8.2.50.0000.00818.10
8.2.40.0040.00420.57
8.2.30.0070.00020.97
8.2.20.0080.00218.00
8.2.10.0040.00418.11
8.2.00.0040.00418.22
8.1.280.0120.00925.92
8.1.270.0040.00423.97
8.1.260.0080.00026.35
8.1.250.0080.00028.09
8.1.240.0000.00921.21
8.1.230.0070.00419.16
8.1.220.0000.00817.74
8.1.210.0060.00318.77
8.1.200.0060.00317.35
8.1.190.0030.00617.35
8.1.180.0000.00918.10
8.1.170.0070.00019.15
8.1.160.0000.00719.07
8.1.150.0080.00020.67
8.1.140.0000.00819.46
8.1.130.0030.00318.96
8.1.120.0040.00417.47
8.1.110.0040.00417.46
8.1.100.0090.00017.44
8.1.90.0040.00417.36
8.1.80.0050.00217.47
8.1.70.0000.00717.31
8.1.60.0080.00417.47
8.1.50.0000.00817.49
8.1.40.0000.00817.47
8.1.30.0040.00417.67
8.1.20.0040.00417.69
8.1.10.0000.00817.63
8.1.00.0000.00917.59
8.0.300.0040.00418.77
8.0.290.0050.00317.00
8.0.280.0000.00818.56
8.0.270.0000.00717.33
8.0.260.0030.00316.91
8.0.250.0040.00417.09
8.0.240.0070.00417.09
8.0.230.0060.00317.07
8.0.220.0040.00416.96
8.0.210.0000.00716.93
8.0.200.0030.00317.04
8.0.190.0040.00417.09
8.0.180.0000.00717.02
8.0.170.0050.00316.96
8.0.160.0000.00716.92
8.0.150.0000.00716.93
8.0.140.0000.00716.82
8.0.130.0040.00413.35
8.0.120.0000.00716.87
8.0.110.0080.00017.03
8.0.100.0000.00716.79
8.0.90.0000.00716.93
8.0.80.0100.01616.96
8.0.70.0040.00416.89
8.0.60.0040.00416.92
8.0.50.0000.00816.84
8.0.30.0130.00717.20
8.0.20.0080.01117.42
8.0.10.0070.00017.09
8.0.00.0170.00016.62
7.4.330.0000.00515.55
7.4.320.0070.00016.62
7.4.300.0030.00316.60
7.4.290.0030.00316.52
7.4.280.0050.00316.59
7.4.270.0070.00016.61
7.4.260.0030.00316.42
7.4.250.0070.00016.64
7.4.240.0000.00716.56
7.4.230.0000.00716.70
7.4.220.0130.00516.59
7.4.210.0000.01516.65
7.4.200.0040.00416.77
7.4.160.0070.01116.61
7.4.150.0090.00917.40
7.4.140.0090.01017.86
7.4.130.0130.00616.71
7.4.120.0080.01116.57
7.3.330.0000.00513.47
7.3.320.0060.00013.35
7.3.310.0000.00716.53
7.3.300.0030.00316.51
7.3.290.0090.00616.47
7.3.280.0080.00816.50
7.3.270.0090.00917.40
7.3.260.0140.00616.54
7.3.250.0100.01016.60
7.3.240.0110.00616.48
7.1.70.0090.00917.05

preferences:
59.37 ms | 401 KiB | 5 Q