3v4l.org

run code in 300+ PHP versions simultaneously
<?php if (!defined('PHP_EOL')) { define('PHP_EOL', "\r\n"); } // 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 .= ((bool)rand(0, 1) ? chr(rand(65, 90)) : rand(0, 9)); } $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;

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.4.00.0070.01315.01
7.3.120.0030.01214.79
7.3.110.0100.01015.04
7.3.100.0090.00614.93
7.3.90.0040.01414.51
7.3.80.0070.00714.91
7.3.70.0080.00814.75
7.3.60.0090.00314.56
7.3.50.0100.00714.71
7.3.40.0030.00914.84
7.3.30.0060.00814.65
7.3.20.0060.00916.73
7.3.10.0120.00316.73
7.3.00.0080.00416.61
7.2.250.0000.01614.97
7.2.240.0030.01214.88
7.2.230.0030.01315.00
7.2.220.0100.00714.70
7.2.210.0060.01115.02
7.2.200.0120.00015.13
7.2.190.0070.01014.74
7.2.180.0090.00615.07
7.2.170.0090.00614.93
7.2.00.0030.00919.46
7.1.330.0030.01015.69
7.1.320.0040.01115.63
7.1.310.0060.00915.72
7.1.300.0100.00715.61
7.1.290.0120.00015.52
7.1.280.0060.00615.77
7.1.270.0040.01115.73
7.1.260.0100.00315.74
7.1.70.0000.01016.86
7.1.60.0130.00619.40
7.1.50.0100.00616.96
7.1.00.0000.08322.50
7.0.200.0090.00016.75
7.0.140.0070.07022.11
7.0.110.0130.07720.08
7.0.100.0130.08319.97
7.0.90.0130.05019.97
7.0.80.0000.08319.96
7.0.70.0200.07319.92
7.0.60.0030.04720.06
7.0.50.0300.05320.05
7.0.40.0100.04019.77
7.0.30.0030.04019.73
7.0.20.0000.04319.84
7.0.10.0030.04019.70
7.0.00.0030.04019.73
5.6.280.0000.09720.92
5.6.260.0070.07720.59
5.6.250.0070.09020.77
5.6.240.0070.07020.56
5.6.230.0170.07320.72
5.6.220.0130.06320.66
5.6.210.0130.06320.64
5.6.200.0100.06720.73
5.6.190.0100.04020.64
5.6.180.0000.04320.58
5.6.170.0030.03720.60
5.6.160.0030.04020.58
5.6.150.0030.07320.63
5.6.140.0070.03720.64
5.6.130.0030.03720.74
5.6.120.0130.02720.63
5.6.110.0100.03320.67
5.6.100.0130.03320.57
5.6.90.0030.04020.56
5.6.80.0070.03720.11
5.6.70.0030.04020.02
5.6.60.0000.04319.98
5.6.50.0070.03020.03
5.6.40.0000.03719.91
5.6.30.0030.04319.96
5.6.20.0070.03720.09
5.6.10.0000.04320.02
5.6.00.0070.05719.93
5.5.380.0070.07317.59
5.5.370.0070.08017.62
5.5.360.0030.08717.49
5.5.350.0100.06717.56
5.5.340.0100.05318.20
5.5.330.0070.03718.05
5.5.320.0000.04718.01
5.5.310.0000.04318.31
5.5.300.0000.04717.97
5.5.290.0030.04018.19
5.5.280.0070.03717.90
5.5.270.0030.04718.15
5.5.260.0100.03318.16
5.5.250.0100.03317.58
5.5.240.0030.03317.55
5.5.230.0000.03717.54
5.5.220.0070.04017.28
5.5.210.0030.03017.14
5.5.200.0030.03317.53
5.5.190.0100.02717.08
5.5.180.0070.03317.30
5.5.160.0030.07717.21
5.5.150.0030.07717.54
5.5.140.0100.03717.48
5.5.130.0070.08317.41
5.5.120.0070.07317.67
5.5.110.0100.06717.20
5.5.100.0070.07317.26
5.5.90.0070.07717.20
5.5.80.0100.08017.13
5.5.70.0170.07017.32
5.5.60.0030.04017.19
5.5.50.0130.07317.39
5.5.40.0070.06717.21
5.5.30.0070.08017.00
5.5.20.0130.07317.41
5.5.10.0030.07717.09
5.5.00.0230.06017.10
5.4.450.0030.04019.55
5.4.440.0030.04319.25
5.4.430.0000.04019.35
5.4.420.0070.03319.52
5.4.410.0070.03719.51
5.4.400.0030.04319.08
5.4.390.0030.04719.02
5.4.380.0000.04018.95
5.4.370.0000.03719.04
5.4.360.0070.02719.02
5.4.350.0030.03019.02
5.4.340.0070.03019.00
5.4.320.0100.05319.18
5.4.310.0030.08319.09
5.4.300.0100.07019.06
5.4.290.0130.07319.32
5.4.280.0130.07319.00
5.4.270.0030.08318.93
5.4.260.0130.05719.02
5.4.250.0030.07718.92
5.4.240.0130.07019.17
5.4.230.0100.03719.32
5.4.220.0100.05719.00
5.4.210.0130.06719.02
5.4.200.0030.05718.94
5.4.190.0130.07319.02
5.4.180.0070.03719.16
5.4.170.0100.04319.05
5.4.160.0100.06018.91
5.4.150.0100.07719.00
5.4.140.0100.06016.47
5.4.130.0130.02716.21
5.4.120.0030.07716.24
5.4.110.0030.07016.13
5.4.100.0030.07716.46
5.4.90.0070.06316.28
5.4.80.0030.08316.17
5.4.70.0070.06316.50
5.4.60.0100.07016.38
5.4.50.0100.06716.25
5.4.40.0100.07316.43
5.4.30.0030.07316.25
5.4.20.0070.07716.34
5.4.10.0030.03716.33
5.4.00.0030.04315.93
5.3.290.0130.05314.70
5.3.280.0170.06714.70
5.3.270.0070.07014.70
5.3.260.0030.09714.70
5.3.250.0070.05714.70
5.3.240.0070.03714.70
5.3.230.0030.08014.70
5.3.220.0030.04014.70
5.3.210.0030.06314.70
5.3.200.0170.03014.70
5.3.190.0100.06014.70
5.3.180.0130.07014.70
5.3.170.0070.06014.70
5.3.160.0070.07714.70
5.3.150.0130.06014.70
5.3.140.0000.07014.70
5.3.130.0030.04014.70
5.3.120.0070.04014.70
5.3.110.0130.06014.70
5.3.100.0030.08014.70
5.3.90.0070.06314.70
5.3.80.0030.07714.70
5.3.70.0070.07014.70
5.3.60.0030.07714.70
5.3.50.0100.07314.70
5.3.40.0000.08314.70
5.3.30.0070.06014.70
5.3.20.0030.07314.70
5.3.10.0070.05314.70
5.3.00.0070.06014.70
5.2.170.0030.05714.70
5.2.160.0030.06314.70
5.2.150.0100.05714.70
5.2.140.0070.05714.70
5.2.130.0070.05014.70
5.2.120.0030.06314.70
5.2.110.0000.06714.70
5.2.100.0100.06014.70
5.2.90.0070.06314.70
5.2.80.0070.06314.70
5.2.70.0070.05714.70
5.2.60.0030.06714.70
5.2.50.0100.05714.70
5.2.40.0030.06014.70
5.2.30.0130.02714.70
5.2.20.0070.05314.70
5.2.10.0070.04014.70
5.2.00.0070.04014.70
5.1.60.0030.05714.70
5.1.50.0130.03314.70
5.1.40.0070.05014.70
5.1.30.0000.04714.70
5.1.20.0100.05314.70
5.1.10.0070.03714.70
5.1.00.0100.04014.70
5.0.50.0030.04714.70
5.0.40.0070.04014.70
5.0.30.0130.02314.70
5.0.20.0000.04714.70
5.0.10.0030.02014.70
5.0.00.0000.07014.70
4.4.90.0030.03014.70
4.4.80.0070.03014.70
4.4.70.0030.02014.70
4.4.60.0070.02714.70
4.4.50.0030.03314.70
4.4.40.0030.03014.70
4.4.30.0030.03314.70
4.4.20.0070.02314.70
4.4.10.0070.03014.70
4.4.00.0100.04714.70
4.3.110.0070.02714.70
4.3.100.0100.02714.70
4.3.90.0030.03314.70
4.3.80.0000.05714.70
4.3.70.0030.03014.70
4.3.60.0030.02714.70
4.3.50.0070.02314.70
4.3.40.0030.04314.70
4.3.30.0070.03314.70
4.3.20.0000.03714.70
4.3.10.0000.03714.70
4.3.00.0030.02014.70

preferences:
39.26 ms | 401 KiB | 5 Q