3v4l.org

run code in 300+ PHP versions simultaneously
<?php function crypto_rand_secure($min, $max) { $range = $max - $min; if ($range < 0) return $min; // not so random... $log = log($range, 2); $bytes = (int) ($log / 8) + 1; // length in bytes $bits = (int) $log + 1; // length in bits $filter = (int) (1 << $bits) - 1; // set all lower bits to 1 do { $rnd = hexdec(bin2hex(openssl_random_pseudo_bytes($bytes))); $rnd = $rnd & $filter; // discard irrelevant bits } while ($rnd >= $range); return $min + $rnd; } function getToken($length){ $token = ""; $codeAlphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; $codeAlphabet.= "abcdefghijklmnopqrstuvwxyz"; $codeAlphabet.= "0123456789"; for($i=0;$i<$length;$i++){ $token .= $codeAlphabet[crypto_rand_secure(0,strlen($codeAlphabet))]; } return $token; } echo ($token); ?>

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.0120.00318.43
8.3.50.0080.00821.20
8.3.40.0110.00718.77
8.3.30.0100.00319.04
8.3.20.0040.00420.21
8.3.10.0080.00021.96
8.3.00.0040.00422.58
8.2.180.0030.01216.50
8.2.170.0090.00622.96
8.2.160.0070.00719.21
8.2.150.0080.00024.18
8.2.140.0050.00324.66
8.2.130.0050.00326.16
8.2.120.0030.00519.56
8.2.110.0030.01422.21
8.2.100.0090.00318.16
8.2.90.0070.00019.13
8.2.80.0000.00817.97
8.2.70.0040.00417.47
8.2.60.0030.00617.93
8.2.50.0080.00018.07
8.2.40.0050.00318.09
8.2.30.0050.00617.91
8.2.20.0030.00517.56
8.2.10.0040.00417.63
8.2.00.0030.00717.71
8.1.280.0070.01425.92
8.1.270.0060.00322.02
8.1.260.0040.00426.35
8.1.250.0000.00728.09
8.1.240.0060.00323.87
8.1.230.0000.01119.16
8.1.220.0030.00517.74
8.1.210.0000.00918.77
8.1.200.0060.00317.23
8.1.190.0040.00417.27
8.1.180.0060.00320.46
8.1.170.0080.00318.43
8.1.160.0070.00022.30
8.1.150.0030.00618.42
8.1.140.0080.00017.32
8.1.130.0050.00317.79
8.1.120.0000.00717.40
8.1.110.0000.00817.32
8.1.100.0030.00317.39
8.1.90.0030.00617.32
8.1.80.0000.00717.33
8.1.70.0050.00217.35
8.1.60.0000.00817.39
8.1.50.0040.00417.43
8.1.40.0040.00417.32
8.1.30.0000.00717.45
8.1.20.0030.00517.53
8.1.10.0000.00817.37
8.1.00.0000.00817.48
8.0.300.0030.00618.77
8.0.290.0000.00817.05
8.0.280.0000.00718.43
8.0.270.0000.00817.15
8.0.260.0000.00616.85
8.0.250.0000.00616.98
8.0.240.0070.00317.02
8.0.230.0040.00416.94
8.0.220.0030.00316.79
8.0.210.0040.00416.86
8.0.200.0030.00316.78
8.0.190.0000.00716.98
8.0.180.0000.00816.92
8.0.170.0040.00416.91
8.0.160.0080.00016.72
8.0.150.0000.00716.82
8.0.140.0000.00716.71
8.0.130.0030.00313.28
8.0.120.0040.00416.82
8.0.110.0070.00016.91
8.0.100.0070.00016.80
8.0.90.0040.00416.83
8.0.80.0110.00416.76
8.0.70.0040.00416.86
8.0.60.0000.00716.74
8.0.50.0000.00816.90
8.0.30.0060.01517.09
8.0.20.0100.00917.40
8.0.10.0040.00416.87
8.0.00.0140.00616.66
7.4.330.0000.00415.08
7.4.320.0060.00016.45
7.4.300.0030.00316.49
7.4.290.0050.00316.31
7.4.280.0070.00016.50
7.4.270.0030.00316.30
7.4.260.0000.00716.41
7.4.250.0050.00216.35
7.4.240.0030.00416.39
7.4.230.0000.00716.53
7.4.220.0110.00716.47
7.4.210.0050.01016.49
7.4.200.0000.00816.44
7.4.190.0030.00316.63
7.4.160.0040.01216.48
7.4.150.0100.01017.40
7.4.140.0070.01017.86
7.4.130.0070.01216.58
7.4.120.0060.01216.47
7.4.110.0110.00716.59
7.4.100.0130.01016.47
7.4.90.0150.00316.43
7.4.80.0080.00819.39
7.4.70.0150.00416.66
7.4.60.0110.00716.33
7.4.50.0040.00416.16
7.4.40.0040.01122.77
7.4.30.0080.01016.63
7.4.00.0110.00414.59
7.3.330.0030.00213.34
7.3.320.0000.00613.11
7.3.310.0040.00416.23
7.3.300.0070.00016.32
7.3.290.0120.00316.32
7.3.280.0060.01116.32
7.3.270.0140.00317.40
7.3.260.0090.00916.71
7.3.250.0060.01216.32
7.3.240.0050.01616.27
7.3.230.0110.01116.50
7.3.210.0070.01116.43
7.3.200.0030.01319.39
7.3.190.0080.01116.38
7.3.180.0070.01316.40
7.3.170.0180.00016.39
7.3.160.0030.01316.33
7.3.120.0070.01014.80
7.2.330.0090.00916.21
7.2.320.0090.00616.43
7.2.310.0110.00616.48
7.2.300.0130.00316.54
7.2.290.0090.00616.47
7.2.110.0000.01516.47
7.2.100.0120.00316.43
7.2.90.0030.01316.70
7.2.80.0060.00916.60
7.2.70.0090.00616.91
7.2.60.0100.00716.78
7.2.50.0040.00416.73
7.2.40.0080.00816.89
7.2.30.0100.00716.50
7.2.20.0040.00416.38
7.2.10.0100.00616.60
7.2.00.0060.01016.79
7.1.230.0060.00315.63
7.1.220.0030.01015.72
7.1.210.0030.00915.41
7.1.200.0070.00715.36
7.1.190.0040.00415.64
7.1.180.0060.00615.57
7.1.170.0040.01215.59
7.1.160.0090.00615.67
7.1.150.0060.00315.78
7.1.140.0060.00615.57
7.1.130.0000.00815.65
7.1.120.0030.01015.58
7.1.110.0000.00915.77
7.1.100.0030.01015.46
7.1.90.0040.00815.57
7.1.80.0090.00015.80
7.1.70.0060.00416.30
7.1.60.0050.01517.67
7.1.50.0080.00916.32
7.1.40.0060.01015.83
7.1.30.0070.01015.77
7.1.20.0140.00415.68
7.1.10.0060.00615.62
7.1.00.0060.03818.96
7.0.310.0040.01115.39
7.0.300.0070.00715.44
7.0.290.0030.00715.25
7.0.280.0000.01415.23
7.0.270.0060.00615.23
7.0.260.0140.00015.25
7.0.250.0070.00715.26
7.0.240.0030.00915.18
7.0.230.0000.01215.35
7.0.220.0060.00615.26
7.0.210.0040.00715.33
7.0.200.0100.00216.04
7.0.190.0040.00715.13
7.0.180.0090.00315.25
7.0.170.0000.01315.32
7.0.160.0000.01615.38
7.0.150.0050.00515.21
7.0.140.0100.03518.59
7.0.130.0040.00815.46
7.0.120.0070.00714.86
7.0.110.0080.00415.41
7.0.100.0090.00315.20
7.0.90.0060.00315.26
7.0.80.0000.01415.47
7.0.70.0000.01215.12
7.0.60.0060.03017.50
7.0.50.0030.03716.48
7.0.40.0100.03816.63
7.0.30.0170.02616.80
7.0.20.0170.04216.74
7.0.10.0110.02816.82
7.0.00.0050.04316.78
5.6.380.0070.00414.18
5.6.370.0000.01014.19
5.6.360.0120.00314.05
5.6.350.0090.00614.09
5.6.340.0110.00014.47
5.6.330.0030.01013.86
5.6.320.0060.00614.32
5.6.310.0030.00614.38
5.6.300.0030.01014.18
5.6.290.0080.00314.15
5.6.280.0030.04117.52
5.6.270.0030.00814.19
5.6.260.0030.01014.14
5.6.250.0030.00714.31
5.6.240.0070.01014.27
5.6.230.0060.00814.19
5.6.220.0040.00714.00
5.6.210.0080.04317.32
5.6.200.0020.02416.14
5.6.190.0060.03917.38
5.6.180.1570.02317.48
5.6.170.0170.03517.38
5.6.160.0070.03917.41
5.6.150.0050.03016.37
5.6.140.0030.02716.29
5.6.130.0030.02916.13
5.6.120.0050.02317.61
5.6.110.0070.02817.64
5.6.100.0060.04617.65
5.6.90.0060.04917.59
5.6.80.0070.03617.33
5.6.70.0000.00813.96
5.6.60.0060.00614.21
5.6.50.0070.00414.05
5.6.40.0060.00913.92
5.6.30.0000.01014.16
5.6.20.0050.00313.83
5.6.10.0070.00714.10
5.6.00.0030.00914.04
5.5.380.0060.00011.14
5.5.370.0050.00310.66
5.5.360.0000.00811.07
5.5.350.0040.04415.80
5.5.340.0050.03314.33
5.5.330.0050.04515.65
5.5.320.0080.02715.73
5.5.310.0170.04015.68
5.5.300.0050.03614.30
5.5.290.0030.04114.46
5.5.280.0020.04815.90
5.5.270.0050.02215.90
5.5.260.0070.04216.04
5.5.250.0040.02815.81
5.5.240.0100.03815.66
5.5.230.0040.00410.83
5.5.220.0040.00410.97
5.5.210.0060.00610.61
5.5.200.0080.00010.84
5.5.190.0060.00611.04
5.5.180.0040.00811.00
5.5.170.0030.00713.87
5.5.160.0000.00910.95
5.5.150.0040.00711.01
5.5.140.0000.01111.03
5.5.130.0040.00411.10
5.5.120.0100.00010.74
5.5.110.0000.00910.75
5.5.100.0040.00410.99
5.5.90.0040.00411.07
5.5.80.0030.00910.80
5.5.70.0040.00810.61
5.5.60.0000.00711.00
5.5.50.0030.00910.73
5.5.40.0050.00011.02
5.5.30.0030.00710.76
5.5.20.0060.00311.13
5.5.10.0000.01110.73
5.5.00.0030.00310.85
5.4.450.0350.03415.19
5.4.440.0370.03515.10
5.4.430.0510.03115.22
5.4.420.0080.03015.21
5.4.410.0520.02515.10
5.4.400.0450.02814.89
5.4.390.0430.03014.60
5.4.380.0200.03614.66
5.4.370.0050.03314.81
5.4.360.0110.02814.60
5.4.350.0080.03014.63
5.4.340.0050.03314.72
5.4.330.0060.00310.94
5.4.320.0050.02211.56
5.4.310.0080.01811.56
5.4.300.0040.02311.77
5.4.290.0050.02011.68
5.4.280.0030.02211.63
5.4.270.0080.01811.66
5.4.260.0040.02211.70
5.4.250.0030.03314.98
5.4.240.0090.03914.88
5.4.230.0080.03114.86
5.4.220.0050.03114.78
5.4.210.0070.03014.79
5.4.200.0070.02814.75
5.4.190.0050.03314.86
5.4.180.0070.02614.96
5.4.170.0110.02514.90
5.4.160.0050.03114.75
5.4.150.0050.03014.76
5.4.140.0050.03013.63
5.4.130.0060.02813.75
5.4.120.0040.02513.61
5.4.110.0080.02713.70
5.4.100.0110.02313.72
5.4.90.0000.02913.66
5.4.80.0090.02513.67
5.4.70.0050.02913.73
5.4.60.0070.02313.73
5.4.50.0070.03913.63
5.4.40.0020.03613.74
5.4.30.0080.02813.56
5.4.20.0170.01713.57
5.4.10.0080.03913.57
5.4.00.0140.02013.48
5.3.290.0050.02811.71
5.3.280.0090.02612.62
5.3.270.0050.03012.61
5.3.260.0000.03212.70
5.3.250.0070.02612.64
5.3.240.0070.02512.65
5.3.230.0070.02612.70
5.3.220.0050.03012.54
5.3.210.0050.02912.60
5.3.200.0070.04012.71
5.3.190.0040.02912.58
5.3.180.0070.02312.63
5.3.170.0080.02812.58
5.3.160.0120.02212.64
5.3.150.0050.03312.63
5.3.140.0060.02612.63
5.3.130.0030.03512.51
5.3.120.0060.02612.50
5.3.110.0080.02512.57
5.3.100.0050.02812.31
5.3.90.0030.03212.36
5.3.80.0070.02812.24
5.3.70.0020.03412.40
5.3.60.0030.02812.26
5.3.50.0080.02812.32
5.3.40.0080.03312.32
5.3.30.0050.02712.22
5.3.20.0050.03112.20
5.3.10.0030.02812.13
5.3.00.0070.02512.24
5.2.170.0120.02310.83
5.2.160.0000.03210.92
5.2.150.0030.03510.83
5.2.140.0030.02410.88
5.2.130.0050.02010.95
5.2.120.0010.02510.90
5.2.110.0020.02510.89
5.2.100.0080.01810.85
5.2.90.0030.02310.90
5.2.80.0000.02710.96
5.2.70.0030.02410.85
5.2.60.0080.02010.83
5.2.50.0030.02310.86
5.2.40.0010.02510.79
5.2.30.0040.02410.79
5.2.20.0100.02410.83
5.2.10.0050.02410.78
5.2.00.0050.02310.66
5.1.60.0030.02810.35
5.1.50.0030.02310.30
5.1.40.0020.02410.42
5.1.30.0070.01710.52
5.1.20.0090.02010.52
5.1.10.0070.02410.38
5.1.00.0030.02110.26
5.0.50.0030.0229.58
5.0.40.0030.0169.48
5.0.30.0030.0229.43
5.0.20.0020.0179.48
5.0.10.0020.0179.48
5.0.00.0030.0209.39
4.4.90.0050.0109.02
4.4.80.0050.0109.02
4.4.70.0030.0119.02
4.4.60.0070.0129.02
4.4.50.0030.0179.02
4.4.40.0020.0189.02
4.4.30.0030.0129.02
4.4.20.0030.0179.02
4.4.10.0020.0169.02
4.4.00.0000.0239.02
4.3.110.0030.0159.02
4.3.100.0060.0109.02
4.3.90.0000.0209.02
4.3.80.0000.0199.02
4.3.70.0030.0119.02
4.3.60.0000.0179.02
4.3.50.0030.0129.02
4.3.40.0020.0189.02
4.3.30.0050.0099.02
4.3.20.0000.0149.02
4.3.10.0030.0129.02
4.3.00.0110.0108.90

preferences:
46.25 ms | 401 KiB | 5 Q