3v4l.org

run code in 300+ PHP versions simultaneously
<?php if (!defined('PHP_EOL')) { define('PHP_EOL', "\r\n"); } for ($count = 0; $count < 100; $count++) { // generate the 32bit byte array (if you have the "openssl_random_pseudo_bytes" function available) if (function_exists('openssl_random_pseudo_bytes')) { $random_key = openssl_random_pseudo_bytes(32); } else { // this is the longer way to do it... $random_key = ''; for( $i = 0; $i < 64; $i++) { $random_key .= chr(mt_rand(65, 90)); } $random_key = hexdec($random_key); } // this is it as hex print "Hex key: " . bin2hex($random_key) . PHP_EOL; print PHP_EOL; // this is the base64 string that you want to save print "Save this string: " . base64_encode($random_key) . PHP_EOL; print 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)
7.3.10.0050.01516.31
7.3.00.0140.00416.62
7.2.130.0210.00516.62
7.2.120.0120.01216.91
7.2.110.0030.01616.47
7.2.100.0070.01616.88
7.2.90.0200.00716.40
7.2.80.0100.01716.74
7.2.70.0120.01216.84
7.2.60.0160.01617.07
7.2.50.0090.01416.73
7.2.40.0160.00716.48
7.2.30.0180.01116.37
7.2.20.0220.00616.79
7.2.10.0230.00416.74
7.2.00.0090.01018.32
7.1.250.0240.00915.46
7.1.70.0080.00317.26
7.1.60.0070.01019.40
7.1.50.0070.01317.11
7.1.00.0000.05022.57
7.0.200.0040.00716.99
7.0.140.0030.07021.99
7.0.60.0000.08719.89
7.0.50.0030.08017.98
7.0.40.0030.04320.46
7.0.30.0230.03720.00
7.0.20.0300.07020.39
7.0.10.0030.05719.99
7.0.00.0130.08020.18
5.6.280.0100.07021.00
5.6.210.0100.08320.73
5.6.200.0030.08318.28
5.6.190.0030.07720.40
5.6.180.0230.08020.43
5.6.170.0270.08720.68
5.6.160.0030.08720.34
5.6.150.0000.08018.21
5.6.140.0070.04018.21
5.6.130.0130.07018.16
5.6.120.0100.07721.00
5.6.110.0000.05021.09
5.6.100.0130.07021.09
5.6.90.0100.05321.14
5.6.80.0030.08020.54
5.6.70.4400.03720.52
5.5.350.0070.04320.47
5.5.340.0070.04718.02
5.5.330.0030.04020.19
5.5.320.0230.08020.18
5.5.310.0270.07320.29
5.5.300.0030.08318.02
5.5.290.0070.08318.02
5.5.280.0170.07720.90
5.5.270.0070.08020.76
5.5.260.0130.07020.96
5.5.250.0100.07020.64
5.5.240.0030.07020.18
5.4.450.0130.05719.37
5.4.440.0830.05719.56
5.4.430.0670.06019.47
5.4.420.1000.05319.63
5.4.410.0670.06019.05
5.4.400.0370.05318.86
5.4.390.0400.05318.69
5.4.380.0200.06018.73
5.4.370.0130.05718.78
5.4.360.0270.04318.59
5.4.350.0070.04011.98
5.4.340.0060.04511.97
5.4.320.0060.04112.46
5.4.310.0090.04512.46
5.4.300.0070.04812.46
5.4.290.0090.04312.46
5.4.280.0070.05112.35
5.4.270.0050.04012.35
5.4.260.0090.04312.35
5.4.250.0070.06018.70
5.4.240.0130.04718.86
5.4.230.0030.06019.06
5.4.220.0070.05718.68
5.4.210.0170.04318.68
5.4.200.0070.05319.06
5.4.190.0030.05718.77
5.4.180.0230.04018.87
5.4.170.0070.05718.70
5.4.160.0100.05018.90
5.4.150.0230.04718.86
5.4.140.0200.04316.46
5.4.130.0200.06716.44
5.4.120.0170.05016.23
5.4.110.0100.05016.41
5.4.100.0130.05016.46
5.4.90.0100.05016.26
5.4.80.0100.05016.36
5.4.70.0070.05316.24
5.4.60.0030.06016.38
5.4.50.0100.05016.41
5.4.40.0070.05316.35
5.4.30.0070.05316.15
5.4.20.0000.05716.45
5.4.10.0070.06016.30
5.4.00.0030.06715.71
5.3.290.0100.04812.80
5.3.280.0100.05014.61
5.3.270.0100.05314.63
5.3.260.0100.05314.61
5.3.250.0200.05314.60
5.3.240.0070.06014.61
5.3.230.0100.08014.43
5.3.220.0130.05014.57
5.3.210.0100.05714.56
5.3.200.0100.05314.42
5.3.190.0070.06014.56
5.3.180.0070.05714.43
5.3.170.0030.08014.48
5.3.160.0130.04714.57
5.3.150.0100.05314.42
5.3.140.0000.06014.41
5.3.130.0100.05714.55
5.3.120.0030.06014.57
5.3.110.0200.04714.24
5.3.100.0070.06014.13
5.3.90.0100.05314.01
5.3.80.0130.05013.71
5.3.70.0170.04713.96
5.3.60.0100.05314.00
5.3.50.0130.06014.00
5.3.40.0130.05013.82
5.3.30.0100.05313.92
5.3.20.0070.08013.46
5.3.10.0230.05713.52
5.3.00.0130.07013.33
5.2.170.0070.04311.14
5.2.160.0070.04310.99
5.2.150.0200.06311.16
5.2.140.0170.05311.16
5.2.130.0030.04710.88
5.2.120.0130.05311.11
5.2.110.0070.05711.09
5.2.100.0130.04711.02
5.2.90.0130.03710.98
5.2.80.0070.06711.18
5.2.70.0200.05010.97
5.2.60.0100.04710.97
5.2.50.0100.04011.04
5.2.40.0200.03310.84
5.2.30.0070.05310.99
5.2.20.0030.04710.95
5.2.10.0100.05010.77
5.2.00.0000.05010.90
5.1.60.0030.04010.09
5.1.50.0100.0379.96
5.1.40.0030.04010.13
5.1.30.0070.03710.30
5.1.20.0130.03310.52
5.1.10.0000.04310.04
5.1.00.0070.04010.22
5.0.50.0000.0408.51
5.0.40.0030.0338.33
5.0.30.0030.0508.20
5.0.20.0030.0338.29
5.0.10.0000.0378.01
5.0.00.0000.0478.09
4.4.90.0000.0407.38
4.4.80.0070.0237.38
4.4.70.0000.0307.38
4.4.60.0000.0307.38
4.4.50.0030.0307.38
4.4.40.0030.0407.38
4.4.30.0070.0237.38
4.4.20.0000.0437.30
4.4.10.0070.0237.30
4.4.00.0130.0307.30
4.3.110.0000.0337.30
4.3.100.0100.0337.29
4.3.90.0030.0237.29
4.3.80.0130.0277.29
4.3.70.0070.0207.23
4.3.60.0030.0277.20
4.3.50.0030.0307.14
4.3.40.0030.0376.98
4.3.30.0030.0276.75
4.3.20.0030.0436.64
4.3.10.0000.0476.38
4.3.00.0130.0436.59

preferences:
34.35 ms | 401 KiB | 5 Q