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.= "0123456789"; for($i=0;$i<$length;$i++){ $token .= $codeAlphabet[crypto_rand_secure(0,strlen($codeAlphabet))]; } return $token; } echo getToken(6);

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.0070.00716.75
8.3.60.0180.00318.55
8.3.50.0130.00722.05
8.3.40.0150.00319.09
8.3.30.0110.00318.74
8.3.20.0030.00619.03
8.3.10.0080.00021.00
8.3.00.0040.00423.65
8.2.180.0100.01317.00
8.2.170.0100.00622.96
8.2.160.0100.00322.21
8.2.150.0000.00824.18
8.2.140.0000.00824.66
8.2.130.0040.00426.16
8.2.120.0040.00419.65
8.2.110.0030.00619.37
8.2.100.0160.00017.84
8.2.90.0040.00418.21
8.2.80.0050.00517.97
8.2.70.0020.00517.75
8.2.60.0000.00818.18
8.2.50.0080.00518.07
8.2.40.0000.00818.28
8.2.30.0040.00421.41
8.2.20.0070.00017.87
8.2.10.0050.00317.91
8.2.00.0030.00617.72
8.1.280.0080.00825.92
8.1.270.0050.00523.93
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0030.00822.61
8.1.230.0080.00421.02
8.1.220.0000.00817.77
8.1.210.0030.00518.94
8.1.200.0060.00317.47
8.1.190.0000.00917.53
8.1.180.0000.00918.10
8.1.170.0050.00318.58
8.1.160.0000.00718.79
8.1.150.0030.00518.71
8.1.140.0000.00717.52
8.1.130.0030.00317.90
8.1.120.0000.00717.38
8.1.110.0070.00317.38
8.1.100.0000.00717.61
8.1.90.0070.00017.51
8.1.80.0040.00417.55
8.1.70.0030.00317.54
8.1.60.0070.00317.68
8.1.50.0000.00817.52
8.1.40.0000.00817.62
8.1.30.0050.00517.71
8.1.20.0000.00817.69
8.1.10.0050.00217.57
8.1.00.0030.00617.61
8.0.300.0000.00720.01
8.0.290.0000.00917.05
8.0.280.0040.00418.53
8.0.270.0070.00017.30
8.0.260.0030.00316.96
8.0.250.0030.00517.10
8.0.240.0100.00017.07
8.0.230.0030.00517.02
8.0.220.0040.00416.90
8.0.210.0000.00717.04
8.0.200.0060.00017.01
8.0.190.0040.00417.04
8.0.180.0000.00717.04
8.0.170.0040.00416.86
8.0.160.0070.00017.08
8.0.150.0040.00416.75
8.0.140.0030.00316.91
8.0.130.0060.00013.41
8.0.120.0030.00616.89
8.0.110.0040.00416.95
8.0.100.0000.00716.82
8.0.90.0050.00217.00
8.0.80.0060.01316.96
8.0.70.0000.00716.87
8.0.60.0040.00416.94
8.0.50.0040.00416.94
8.0.30.0030.01517.27
8.0.20.0100.00917.40
8.0.10.0040.00417.18
8.0.00.0110.00617.09
7.4.330.0000.00516.99
7.4.320.0070.00016.67
7.4.300.0030.00316.77
7.4.290.0030.00316.76
7.4.280.0060.00316.82
7.4.270.0040.00416.82
7.4.260.0000.00513.47
7.4.250.0040.00416.78
7.4.240.0040.00416.86
7.4.230.0030.00316.56
7.4.220.0150.00416.50
7.4.210.0050.00916.63
7.4.200.0000.00716.74
7.4.190.0000.00816.78
7.4.160.0070.01316.64
7.4.150.0120.01017.40
7.4.140.0100.01017.86
7.4.130.0120.00616.65
7.4.120.0180.00316.64
7.4.110.0130.01016.45
7.4.100.0090.00916.65
7.4.90.0000.02016.59
7.4.80.0170.00019.39
7.4.70.0150.00916.79
7.4.60.0170.00316.64
7.4.50.0050.00316.63
7.4.40.0140.00322.77
7.4.30.0040.01216.66
7.4.00.0070.01015.02
7.3.330.0000.00513.50
7.3.320.0040.00813.65
7.3.310.0040.00216.53
7.3.300.0000.00816.60
7.3.290.0100.01016.45
7.3.280.0080.01116.44
7.3.270.0070.01017.40
7.3.260.0080.01018.24
7.3.250.0120.00816.69
7.3.240.0100.00616.64
7.3.230.0100.00616.44
7.3.210.0040.01416.50
7.3.200.0090.01219.39
7.3.190.0070.01116.44
7.3.180.0140.00316.46
7.3.170.0040.01216.48
7.3.160.0130.00616.67
7.3.120.0070.01015.20
7.3.10.0130.00017.03
7.3.00.0030.00616.70
7.2.330.0040.01416.67
7.2.320.0100.00716.81
7.2.310.0140.00716.55
7.2.300.0030.01316.70
7.2.290.0070.01416.91
7.2.130.0040.01216.93
7.2.120.0060.00917.21
7.2.110.0100.00617.17
7.2.100.0040.01217.03
7.2.90.0060.00616.98
7.2.80.0040.00717.30
7.2.70.0030.00717.23
7.2.60.0000.01417.46
7.2.50.0110.00416.98
7.2.40.0040.00817.15
7.2.30.0090.00617.21
7.2.20.0000.01616.94
7.2.10.0030.01517.00
7.2.00.0070.01017.24
7.1.250.0070.00716.23
7.1.70.0000.00817.69
7.1.60.0000.01117.70
7.1.50.0040.00717.38
7.1.40.0060.00616.97
7.1.30.0030.00916.99
7.1.20.0040.00717.15
7.1.10.0030.00616.87
7.1.00.0000.00816.96
7.0.200.0000.00717.28
7.0.190.0030.00517.15
7.0.180.0000.00816.72
7.0.170.0000.00816.77
7.0.160.0040.00416.63
7.0.150.0050.00316.55
7.0.140.0000.00716.61
7.0.130.0000.00716.91
7.0.120.0000.00717.00
7.0.110.0050.00216.58
7.0.100.0030.00516.76
7.0.90.0040.00416.75
7.0.80.0000.00716.70
7.0.70.0030.00516.77
7.0.60.0000.00716.49
7.0.50.0000.00816.64
7.0.40.0000.00915.09
7.0.30.0040.00415.16
7.0.20.0030.00614.84
7.0.10.0070.00314.84
7.0.00.0090.00015.02
5.6.300.0040.03920.89
5.6.290.0100.03321.25
5.6.280.0000.05221.35
5.6.270.0000.04421.36
5.6.260.0000.04721.13
5.6.250.0070.04121.15
5.6.240.0070.03721.20
5.6.230.0030.06721.06
5.6.220.0030.04521.09
5.6.210.0000.04521.25
5.6.200.0070.05421.05
5.6.190.0030.04721.21
5.6.180.0070.05121.03
5.6.170.0030.03921.26
5.6.160.0060.03621.24
5.6.150.0070.04621.44
5.6.140.0030.04521.00
5.6.130.0070.03721.34
5.6.120.0200.03621.26
5.6.110.0030.06821.04
5.6.100.0030.04721.27
5.6.90.0000.04421.18
5.6.80.0030.05620.72
5.6.70.0030.04320.65
5.6.60.0040.03920.40
5.6.50.0030.03820.44
5.6.40.0070.03520.56
5.6.30.0030.04420.68
5.6.20.0040.03920.44
5.6.10.0070.04420.38
5.6.00.0070.04320.61
5.5.380.0100.03117.79
5.5.370.0030.04017.81
5.5.360.0040.03917.70
5.5.350.0000.05217.73
5.5.340.0060.05118.25
5.5.330.0030.04017.96
5.5.320.0070.04018.29
5.5.310.0030.05618.29
5.5.300.0000.04418.45
5.5.290.0030.04218.38
5.5.280.0070.03918.09
5.5.270.0070.05618.43
5.5.260.0000.04617.98
5.5.250.0000.04318.09
5.5.240.0070.03717.73
5.5.230.0030.04017.56
5.5.220.0030.04517.55
5.5.210.0130.02917.33
5.5.200.0030.04217.53
5.5.190.0030.04017.63
5.5.180.0200.03717.63
5.5.160.0070.03617.71
5.5.150.0000.04017.30
5.5.140.0030.04117.78
5.5.130.0110.03217.52
5.5.120.0000.04817.68
5.5.110.0000.04617.63
5.5.100.0000.04417.51
5.5.90.0030.04317.21
5.5.80.0000.04317.57
5.5.70.0130.04017.33
5.5.60.0030.04217.53
5.5.50.0000.04317.61
5.5.40.0030.04717.23
5.5.30.0170.03717.23
5.5.20.0130.04717.64
5.5.10.0100.03417.47
5.5.00.0230.03617.59
5.4.450.0160.04319.50
5.4.440.0030.04719.85
5.4.430.0100.03619.57
5.4.420.0100.04519.59
5.4.410.0000.04419.56
5.4.400.0030.03819.33
5.4.390.0040.03919.45
5.4.380.0070.03419.46
5.4.370.0000.04319.28
5.4.360.0060.04219.61
5.4.350.0040.03919.52
5.4.340.0000.04019.33
5.4.320.0030.04219.32
5.4.310.0060.03519.28
5.4.300.0040.03919.16
5.4.290.0030.03919.46
5.4.280.0030.03819.32
5.4.270.0000.04219.24
5.4.260.0060.03819.52
5.4.250.0200.03319.19
5.4.240.0030.04119.25
5.4.230.0000.04119.32
5.4.220.0030.04119.16
5.4.210.0030.05119.16
5.4.200.0070.03619.12
5.4.190.0100.03019.43
5.4.180.0060.03519.29
5.4.170.0000.04019.23
5.4.160.0030.04219.21
5.4.150.0070.03719.15
5.4.140.0030.03816.88
5.4.130.0030.03616.90
5.4.120.0100.03817.04
5.4.110.0040.04217.17
5.4.100.0030.03816.94
5.4.90.0030.03916.99
5.4.80.0070.03316.87
5.4.70.0030.03516.97
5.4.60.0000.03816.69
5.4.50.0000.03916.79
5.4.40.0030.03716.84
5.4.30.0030.03416.70
5.4.20.0030.03616.83
5.4.10.0060.03416.84
5.4.00.0030.03516.49
5.3.290.0030.03714.84
5.3.280.0000.04614.84
5.3.270.0000.04415.27
5.3.260.0030.04715.08
5.3.250.0170.04315.08
5.3.240.0070.03315.27
5.3.230.0140.03415.29
5.3.220.0000.04214.84
5.3.210.0000.04214.84
5.3.200.0030.04114.84
5.3.190.0030.04115.18
5.3.180.0000.04615.00
5.3.170.0030.04115.20
5.3.160.0070.03315.13
5.3.150.0090.03515.02
5.3.140.0030.07215.02
5.3.130.0030.03914.84
5.3.120.0070.03814.84
5.3.110.0030.03714.92
5.3.100.0030.03914.84
5.3.90.0030.03614.84
5.3.80.0000.04014.84
5.3.70.0000.04014.84
5.3.60.0000.04114.84
5.3.50.0090.03114.84
5.3.40.0000.04614.84
5.3.30.0060.04114.84
5.3.20.0100.04114.84
5.3.10.0030.03314.84
5.3.00.0030.03414.84
5.2.170.0000.03314.84
5.2.160.0000.03514.84
5.2.150.0070.02714.84
5.2.140.0000.03314.84
5.2.130.0060.02914.84
5.2.120.0030.02914.84
5.2.110.0030.03014.84
5.2.100.0000.03014.84
5.2.90.0000.03214.84
5.2.80.0040.03214.84
5.2.70.0000.03214.84
5.2.60.0170.03014.84
5.2.50.0000.04314.84
5.2.40.0030.02914.84
5.2.30.0030.03214.84
5.2.20.0030.02814.84
5.2.10.0070.02714.84
5.2.00.0000.03214.84
5.1.60.0000.02714.84
5.1.50.0030.02414.84
5.1.40.0070.02314.84
5.1.30.0040.02914.84
5.1.20.0030.02514.84
5.1.10.0000.02614.84
5.1.00.0030.02514.84
5.0.50.0040.02114.84
5.0.40.0030.01814.84
5.0.30.0000.03314.84
5.0.20.0030.02314.84
5.0.10.0090.01214.84
5.0.00.0200.02414.84
4.4.90.0000.01614.84
4.4.80.0000.01714.84
4.4.70.0040.01414.84
4.4.60.0130.01314.84
4.4.50.0070.01414.84
4.4.40.0030.02314.84
4.4.30.0000.01814.84
4.4.20.0030.01514.84
4.4.10.0000.01714.84
4.4.00.0030.02214.84
4.3.110.0000.01814.84
4.3.100.0000.01714.84
4.3.90.0000.01614.84
4.3.80.0000.03114.84
4.3.70.0030.01314.84
4.3.60.0000.01714.84
4.3.50.0000.01914.84
4.3.40.0030.02214.84
4.3.30.0000.01614.84
4.3.20.0130.01014.84
4.3.10.0030.01314.84
4.3.00.0030.01414.84

preferences:
59.11 ms | 401 KiB | 5 Q