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)mt_rand(0, 1) ? chr(mt_rand(65, 90)) : mt_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.10.0110.00714.86
7.4.00.0050.01214.91
7.3.130.0080.01114.90
7.3.120.0050.01314.73
7.3.110.0070.01214.66
7.3.100.0060.01214.73
7.3.90.0090.00914.78
7.3.80.0030.01014.93
7.3.70.0050.00814.75
7.3.60.0070.00514.78
7.3.50.0070.00814.77
7.3.40.0030.01014.67
7.3.30.0090.00714.84
7.3.20.0050.01016.65
7.3.10.0070.00816.66
7.3.00.0060.00416.68
7.2.260.0090.00515.11
7.2.250.0060.00914.99
7.2.240.0070.01114.99
7.2.230.0080.00515.01
7.2.220.0060.00815.23
7.2.210.0030.01315.18
7.2.200.0070.00715.08
7.2.190.0020.01215.01
7.2.180.0070.00615.13
7.2.170.0040.00914.98
7.2.160.0070.00715.11
7.2.150.0060.00916.99
7.2.140.0030.01116.89
7.2.130.0040.01116.89
7.2.120.0050.00916.89
7.2.110.0050.00816.81
7.2.100.0090.00517.03
7.2.90.0080.00817.05
7.2.80.0090.00716.96
7.2.70.0050.00816.98
7.2.60.0070.00816.95
7.2.50.0050.01117.10
7.2.40.0090.00416.97
7.2.30.0040.00817.08
7.2.20.0020.01116.89
7.2.10.0070.00916.80
7.2.00.0080.00917.67
7.1.330.0080.00715.96
7.1.320.0070.00715.86
7.1.310.0060.00815.76
7.1.300.0060.00815.68
7.1.290.0060.00815.70
7.1.280.0050.00515.70
7.1.270.0060.00815.65
7.1.260.0020.01115.84
7.1.250.0040.01015.84
7.1.240.0110.00215.83
7.1.230.0020.01115.79
7.1.220.0070.00315.87
7.1.210.0080.00615.89
7.1.200.0000.01715.86
7.1.190.0090.00515.63
7.1.180.0080.00815.75
7.1.170.0060.00815.80
7.1.160.0030.01015.62
7.1.150.0100.00515.71
7.1.140.0030.00815.84
7.1.130.0070.01015.73
7.1.120.0050.00715.82
7.1.110.0000.01515.76
7.1.100.0100.00215.83
7.1.90.0070.00815.55
7.1.80.0070.00915.81
7.1.70.0070.00416.29
7.1.60.0080.01016.98
7.1.50.0070.01016.32
7.1.40.0030.00915.81
7.1.30.0090.00415.62
7.1.20.0090.00515.67
7.1.10.0030.00915.65
7.1.00.0030.01718.05
7.0.330.0080.00515.27
7.0.320.0090.00515.32
7.0.310.0090.00315.45
7.0.300.0030.00815.51
7.0.290.0060.00915.43
7.0.280.0030.00715.35
7.0.270.0080.00615.45
7.0.260.0070.00815.13
7.0.250.0060.00815.35
7.0.240.0020.01415.38
7.0.230.0070.00415.46
7.0.220.0070.00715.51
7.0.210.0070.00715.49
7.0.200.0070.00515.87
7.0.190.0040.00915.48
7.0.180.0040.00915.29
7.0.170.0010.00915.51
7.0.160.0020.01415.39
7.0.150.0080.00515.53
7.0.140.0080.02417.73
7.0.130.0010.01015.44
7.0.120.0060.00915.45
7.0.110.0060.00315.35
7.0.100.0090.00415.44
7.0.90.0030.00815.52
7.0.80.0080.00315.54
7.0.70.0310.03216.98
7.0.60.0320.02717.01
7.0.50.0370.03016.98
7.0.40.0080.02215.66
7.0.30.0060.03415.76
7.0.20.0100.02915.71
7.0.10.0060.02415.73
7.0.00.0050.03115.62
5.6.400.0020.01114.29
5.6.390.0020.01214.48
5.6.380.0060.00714.25
5.6.370.0090.00614.46
5.6.360.0020.01414.53
5.6.350.0050.01114.32
5.6.340.0050.01014.20
5.6.330.0070.00914.29
5.6.320.0080.00714.43
5.6.310.0070.00514.65
5.6.300.0060.00814.42
5.6.290.0080.00614.31
5.6.280.0010.03416.71
5.6.270.0050.00714.42
5.6.260.0010.00914.39
5.6.250.0100.00514.41
5.6.240.0060.00514.44
5.6.230.0060.00814.51
5.6.220.0040.03316.46
5.6.210.0040.03016.44
5.6.200.0100.03216.57
5.6.190.0040.03116.49
5.6.180.0060.03416.62
5.6.170.0050.03516.55
5.6.160.0100.03016.57
5.6.150.0110.02816.61
5.6.140.0060.02616.66
5.6.130.0060.02716.56
5.6.120.0080.02916.67
5.6.110.0050.03216.65
5.6.100.0040.03416.53
5.6.90.0070.03516.63
5.6.80.0090.02016.37
5.6.70.0100.02816.27
5.6.60.0050.03416.30
5.6.50.0090.03316.46
5.6.40.0080.03116.49
5.6.30.0060.02516.45
5.6.20.0030.03216.28
5.6.10.0080.03116.33
5.6.00.0050.03016.34
5.5.380.0110.00514.45
5.5.370.0050.00814.41
5.5.360.0060.03016.42
5.5.350.0060.03416.43
5.5.340.0040.02616.67
5.5.330.0060.03416.69
5.5.320.0060.03716.64
5.5.310.0090.03216.48
5.5.300.0110.02116.59
5.5.290.0060.03516.57
5.5.280.0060.02216.57
5.5.270.0020.04116.62
5.5.260.0050.03216.60
5.5.250.0080.03216.38
5.5.240.0100.02116.21
5.5.230.0060.03016.27
5.5.220.0050.02416.32
5.5.210.0060.03216.36
5.5.200.0070.02916.25
5.5.190.0050.03316.15
5.5.180.0030.02716.08
5.5.170.0050.00914.22
5.5.160.0030.03416.19
5.5.150.0080.03116.25
5.5.140.0090.02916.14
5.5.130.0050.03416.11
5.5.120.0060.03116.18
5.5.110.0070.03216.31
5.5.100.0070.02516.20
5.5.90.0110.02716.14
5.5.80.0080.03116.24
5.5.70.0110.02816.25
5.5.60.0090.02916.21
5.5.50.0050.03116.09
5.5.40.0090.02316.24
5.5.30.0050.03316.22
5.5.20.0050.02416.23
5.5.10.0040.02116.22
5.5.00.0030.03416.08
5.4.450.0070.02814.46
5.4.440.0030.03414.50
5.4.430.0030.03314.35
5.4.420.0030.02314.37
5.4.410.0050.02414.42
5.4.400.0070.01714.27
5.4.390.0040.02514.28
5.4.380.0050.02514.27
5.4.370.0050.03114.29
5.4.360.0060.03114.18
5.4.350.0040.03314.31
5.4.340.0060.02714.30
5.4.330.0050.00412.08
5.4.320.0050.02314.26
5.4.310.0050.03014.29
5.4.300.0060.02814.24
5.4.290.0060.02914.31
5.4.280.0060.02614.27
5.4.270.0090.02614.37
5.4.260.0090.02514.21
5.4.250.0060.02514.29
5.4.240.0090.02214.22
5.4.230.0040.03014.19
5.4.220.0070.02814.18
5.4.210.0060.02814.30
5.4.200.0020.03114.24
5.4.190.0060.02714.28
5.4.180.0050.02814.33
5.4.170.0070.02814.28
5.4.160.0040.03214.30
5.4.150.0030.02514.28
5.4.140.0010.03113.41
5.4.130.0060.02413.40
5.4.120.0050.02813.32
5.4.110.0060.02213.33
5.4.100.0070.02613.42
5.4.90.0050.03013.41
5.4.80.0060.03013.46
5.4.70.0070.02713.36
5.4.60.0040.02913.30
5.4.50.0110.02513.34
5.4.40.0020.03313.42
5.4.30.0070.02513.34
5.4.20.0050.02813.44
5.4.10.0060.02213.34
5.4.00.0030.01913.20
5.3.290.0060.02312.69
5.3.280.0080.02712.61
5.3.270.0040.02512.62
5.3.260.0030.02912.64
5.3.250.0070.02412.63
5.3.240.0020.03112.51
5.3.230.0060.02112.61
5.3.220.0050.02212.51
5.3.210.0100.02112.58
5.3.200.0090.02312.58
5.3.190.0050.02412.49
5.3.180.0020.02412.51
5.3.170.0020.03012.58
5.3.160.0070.02612.61
5.3.150.0070.02612.54
5.3.140.0050.03012.60
5.3.130.0070.02912.54
5.3.120.0050.02812.53
5.3.110.0020.02012.53
5.3.100.0030.01712.42
5.3.90.0000.01812.41
5.3.80.0070.01212.33
5.3.70.0020.01712.36
5.3.60.0040.01512.39
5.3.50.0050.02512.39
5.3.40.0060.01312.37
5.3.30.0020.01712.28
5.3.20.0040.01412.16
5.3.10.0030.02412.18
5.3.00.0010.02212.17
5.2.170.0000.03312.29
5.2.160.0030.03012.29
5.2.150.0000.04312.29
5.2.140.0070.02712.29
5.2.130.0030.05312.29
5.2.120.0030.04012.29
5.2.110.0030.05312.29
5.2.100.0030.04012.29
5.2.90.0070.02712.29
5.2.80.0030.03012.29
5.2.70.0070.02712.29
5.2.60.0030.04712.29
5.2.50.0000.04012.29
5.2.40.0070.02712.29
5.2.30.0070.03012.29
5.2.20.0000.04012.29
5.2.10.0070.04012.29
5.2.00.0000.03012.29
5.1.60.0000.02712.29
5.1.50.0000.02712.29
5.1.40.0000.02712.29
5.1.30.0070.05012.29
5.1.20.0070.02312.29
5.1.10.0000.03012.29
5.1.00.0030.02312.29
5.0.50.0000.03312.29
5.0.40.0030.02012.29
5.0.30.0000.03312.29
5.0.20.0030.02312.29
5.0.10.0030.02012.29
5.0.00.0000.03312.29
4.4.90.0000.02012.29
4.4.80.0070.01012.29
4.4.70.0000.01712.29
4.4.60.0030.02312.29
4.4.50.0030.01312.29
4.4.40.0000.02712.29
4.4.30.0000.01712.29
4.4.20.0000.01712.29
4.4.10.0030.02012.29
4.4.00.0000.04312.29
4.3.110.0000.01712.29
4.3.100.0000.01712.29
4.3.90.0000.04012.29
4.3.80.0000.02312.29
4.3.70.0000.01712.29
4.3.60.0000.01712.29
4.3.50.0030.01312.29
4.3.40.0000.02312.29
4.3.30.0030.02312.29
4.3.20.0000.01712.29
4.3.10.0070.01012.29
4.3.00.0030.01312.29

preferences:
39.92 ms | 400 KiB | 5 Q