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; } getToken(); ?>

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.0140.00618.55
8.3.50.0120.00721.14
8.3.40.0120.00618.92
8.3.30.0110.00419.07
8.3.20.0040.00420.17
8.3.10.0000.00721.92
8.3.00.0000.00822.29
8.2.180.0140.00716.50
8.2.170.0140.00722.96
8.2.160.0070.00719.21
8.2.150.0050.00324.18
8.2.140.0080.00024.66
8.2.130.0000.00826.16
8.2.120.0000.00819.52
8.2.110.0040.00421.94
8.2.100.0060.00619.51
8.2.90.0000.00919.09
8.2.80.0000.00817.97
8.2.70.0030.00617.50
8.2.60.0100.00317.93
8.2.50.0060.00318.07
8.2.40.0030.00619.76
8.2.30.0040.00817.99
8.2.20.0040.00417.62
8.2.10.0070.00017.68
8.2.00.0040.00617.76
8.1.280.0130.00725.92
8.1.270.0060.00322.19
8.1.260.0070.00026.35
8.1.250.0040.00428.09
8.1.240.0040.00423.82
8.1.230.0040.00818.97
8.1.220.0000.00917.74
8.1.210.0080.00018.77
8.1.200.0060.00317.23
8.1.190.0070.00317.41
8.1.180.0040.00418.61
8.1.170.0070.00318.57
8.1.160.0040.00422.15
8.1.150.0000.00818.59
8.1.140.0000.00817.35
8.1.130.0030.00317.78
8.1.120.0000.00717.30
8.1.110.0040.00417.42
8.1.100.0000.00717.34
8.1.90.0040.00417.33
8.1.80.0000.00717.28
8.1.70.0050.00217.27
8.1.60.0070.00017.60
8.1.50.0040.00417.43
8.1.40.0080.00017.36
8.1.30.0000.00717.48
8.1.20.0040.00417.45
8.1.10.0070.00017.50
8.1.00.0040.00417.40
8.0.300.0030.00518.77
8.0.290.0050.00217.05
8.0.280.0030.00318.42
8.0.270.0030.00317.27
8.0.260.0060.00016.92
8.0.250.0040.00417.02
8.0.240.0080.00316.96
8.0.230.0030.00316.98
8.0.220.0000.00716.88
8.0.210.0070.00016.93
8.0.200.0030.00316.91
8.0.190.0000.00716.96
8.0.180.0040.00416.82
8.0.170.0000.00716.98
8.0.160.0000.00816.85
8.0.150.0070.00016.75
8.0.140.0000.00716.77
8.0.130.0030.00313.34
8.0.120.0050.00216.85
8.0.110.0080.00016.96
8.0.100.0000.00816.79
8.0.90.0040.00416.86
8.0.80.0130.00316.88
8.0.70.0000.00816.90
8.0.60.0070.00016.87
8.0.50.0030.00316.82
8.0.30.0080.01017.06
8.0.20.0080.01217.40
8.0.10.0000.00716.97
8.0.00.0070.01216.59
7.4.330.0020.00215.07
7.4.320.0040.00416.44
7.4.300.0000.00616.54
7.4.290.0000.00716.55
7.4.280.0030.00316.54
7.4.270.0030.00316.48
7.4.260.0030.00316.56
7.4.250.0000.00716.31
7.4.240.0040.00416.44
7.4.230.0080.00016.66
7.4.220.0070.01016.45
7.4.210.0100.00416.56
7.4.200.0040.00416.37
7.4.190.0000.00716.61
7.4.160.0070.00716.64
7.4.150.0130.00317.40
7.4.140.0110.00617.86
7.4.130.0160.00016.47
7.4.120.0080.00816.61
7.4.110.0100.01316.37
7.4.100.0120.00616.53
7.4.90.0090.01016.27
7.4.80.0030.01619.39
7.4.70.0070.01116.46
7.4.60.0090.01316.28
7.4.50.0030.00516.66
7.4.40.0070.00722.77
7.4.30.0140.00516.35
7.4.00.0070.00715.02
7.3.330.0060.00013.32
7.3.320.0050.00013.17
7.3.310.0050.00316.36
7.3.300.0070.00016.37
7.3.290.0120.00316.34
7.3.280.0030.01316.29
7.3.270.0100.00617.40
7.3.260.0150.00416.36
7.3.250.0110.01016.28
7.3.240.0090.00916.65
7.3.230.0060.01016.48
7.3.210.0130.00416.38
7.3.200.0090.00619.39
7.3.190.0070.01016.40
7.3.180.0110.00616.46
7.3.170.0030.01316.63
7.3.160.0080.00816.45
7.3.120.0080.00814.55
7.3.00.0040.00716.78
7.2.330.0130.00716.49
7.2.320.0130.00316.53
7.2.310.0070.01016.52
7.2.300.0100.00616.38
7.2.290.0150.00616.58
7.2.130.0070.00716.58
7.2.120.0140.00016.66
7.2.110.0130.00616.61
7.2.100.0130.00016.72
7.2.90.0000.01316.66
7.2.80.0030.00916.65
7.2.70.0070.01016.58
7.2.60.0100.00316.88
7.2.50.0080.00816.59
7.2.40.0070.00716.59
7.2.30.0030.01616.86
7.2.20.0070.01016.72
7.2.10.0030.00916.58
7.2.00.0050.00918.04
7.1.250.0110.00015.59
7.1.240.0030.00715.30
7.1.230.0060.00615.73
7.1.220.0030.00615.60
7.1.210.0030.00915.38
7.1.200.0030.00915.59
7.1.190.0030.00615.47
7.1.180.0090.00415.51
7.1.170.0030.00715.62
7.1.160.0000.01415.34
7.1.150.0000.01415.63
7.1.140.0090.00015.65
7.1.130.0140.00315.24
7.1.120.0030.00615.35
7.1.110.0100.01015.71
7.1.100.0000.01215.38
7.1.90.0000.01315.34
7.1.80.0070.00715.66
7.1.70.0020.00716.25
7.1.60.0070.00817.52
7.1.50.0070.00816.28
7.1.40.0090.00915.09
7.1.30.0060.00615.30
7.1.20.0080.00815.46
7.1.10.0060.01015.57
7.1.00.0020.02618.81
7.0.330.0140.00315.19
7.0.320.0110.00415.34
7.0.310.0040.00715.18
7.0.300.0000.01215.18
7.0.290.0030.00615.10
7.0.280.0070.00715.30
7.0.270.0070.00315.38
7.0.260.0030.00615.38
7.0.250.0080.00315.36
7.0.240.0070.00715.24
7.0.230.0000.01015.34
7.0.220.0150.00415.58
7.0.210.0000.00915.19
7.0.200.0040.00615.72
7.0.190.0110.00315.39
7.0.180.0060.00815.48
7.0.170.0120.00315.40
7.0.160.0000.00815.37
7.0.150.0040.00715.20
7.0.140.0100.03718.65
7.0.130.0070.00715.18
7.0.120.0030.00615.34
7.0.110.0070.00415.32
7.0.100.0110.00815.21
7.0.90.0070.00715.09
7.0.80.0030.00715.23
7.0.70.0090.00015.41
7.0.60.0000.05117.75
7.0.50.0070.03116.67
7.0.40.0090.04416.64
7.0.30.0200.04216.87
7.0.20.0200.04016.70
7.0.10.0180.03516.80
7.0.00.0020.03416.77
5.6.380.0090.00614.30
5.6.370.0060.00614.27
5.6.360.0030.00814.26
5.6.350.0060.00614.48
5.6.340.0090.00614.57
5.6.330.0040.01114.05
5.6.320.0040.00814.46
5.6.310.0000.01514.34
5.6.300.0070.00714.10
5.6.290.0080.00314.28
5.6.280.0040.04017.47
5.6.270.0030.00614.20
5.6.260.0070.00714.18
5.6.250.0060.00614.23
5.6.240.0060.00614.38
5.6.230.0000.01614.05
5.6.220.0040.01114.20
5.6.210.0170.03717.41
5.6.200.0070.02216.23
5.6.190.0120.03817.36
5.6.180.1830.02317.34
5.6.170.0120.03217.41
5.6.160.0080.04517.37
5.6.150.0020.04916.21
5.6.140.0000.02616.22
5.6.130.0110.03816.22
5.6.120.0070.03217.54
5.6.110.0080.04317.48
5.6.100.0070.03117.58
5.6.90.0120.04017.48
5.6.80.0030.04217.36
5.6.70.0070.02817.13
5.6.60.0120.00314.32
5.6.50.0040.00414.12
5.6.40.0070.01014.04
5.6.30.0040.01214.05
5.6.20.0040.00813.95
5.6.10.0030.01014.07
5.6.00.0000.01014.11
5.5.380.0060.00310.70
5.5.370.0030.00810.76
5.5.360.0030.00610.84
5.5.350.0050.04515.53
5.5.340.0050.02614.48
5.5.330.0040.03015.70
5.5.320.0120.02215.72
5.5.310.0150.04215.70
5.5.300.0020.04514.46
5.5.290.0080.04314.47
5.5.280.0100.04315.89
5.5.270.0080.01715.99
5.5.260.0050.03516.00
5.5.250.0050.02915.80
5.5.240.0050.03515.47
5.5.230.0030.00710.96
5.5.220.0050.00511.14
5.5.210.0030.00310.74
5.5.200.0030.00611.14
5.5.190.0080.00010.79
5.5.180.0030.00310.80
5.5.170.0040.00411.13
5.5.160.0040.00811.03
5.5.150.0110.00010.78
5.5.140.0070.00311.20
5.5.130.0040.01110.71
5.5.120.0060.00610.79
5.5.110.0040.00410.69
5.5.100.0030.00710.91
5.5.90.0080.00410.88
5.5.80.0050.00310.89
5.5.70.0030.01010.63
5.5.60.0050.00211.09
5.5.50.0030.00711.08
5.5.40.0000.01010.72
5.5.30.0020.00510.86
5.5.20.0080.00010.96
5.5.10.0030.01010.81
5.5.00.0100.00311.06
5.4.450.0290.03215.15
5.4.440.0290.03715.19
5.4.430.0580.02715.27
5.4.420.0290.02615.20
5.4.410.0670.03214.94
5.4.400.0700.02614.83
5.4.390.0460.03114.83
5.4.380.0230.02714.74
5.4.370.0170.02014.86
5.4.360.0120.02714.74
5.4.350.0070.03214.67
5.4.340.0120.02714.58
5.4.330.0000.01010.71
5.4.320.0050.02211.72
5.4.310.0100.01811.82
5.4.300.0040.02811.67
5.4.290.0090.02411.62
5.4.280.0040.02411.65
5.4.270.0060.02111.59
5.4.260.0050.02211.66
5.4.250.0050.03214.86
5.4.240.0050.03014.85
5.4.230.0070.02514.89
5.4.220.0070.03914.91
5.4.210.0050.04215.05
5.4.200.0070.04114.84
5.4.190.0040.03414.67
5.4.180.0110.02514.61
5.4.170.0070.04014.79
5.4.160.0020.03314.92
5.4.150.0090.04014.98
5.4.140.0070.02713.69
5.4.130.0060.02813.66
5.4.120.0060.03113.70
5.4.110.0090.02313.57
5.4.100.0050.02513.73
5.4.90.0030.02913.61
5.4.80.0070.02813.65
5.4.70.0020.03213.71
5.4.60.0070.02713.75
5.4.50.0050.02813.67
5.4.40.0080.03013.73
5.4.30.0130.02513.78
5.4.20.0000.04013.74
5.4.10.0050.03113.83
5.4.00.0090.02213.48
5.3.290.0060.02311.66
5.3.280.0030.03912.68
5.3.270.0030.04112.75
5.3.260.0070.03312.61
5.3.250.0020.03012.57
5.3.240.0020.03212.45
5.3.230.0070.02812.52
5.3.220.0060.03812.42
5.3.210.0050.03812.60
5.3.200.0070.02812.58
5.3.190.0100.03512.40
5.3.180.0050.03812.69
5.3.170.0000.03212.66
5.3.160.0060.02712.59
5.3.150.0080.02512.70
5.3.140.0120.02212.54
5.3.130.0030.03012.65
5.3.120.0050.03112.57
5.3.110.0030.03012.68
5.3.100.0080.02312.28
5.3.90.0080.02312.34
5.3.80.0100.02212.28
5.3.70.0020.02812.30
5.3.60.0070.02312.31
5.3.50.0070.02612.24
5.3.40.0110.02012.17
5.3.30.0090.02212.30
5.3.20.0070.02612.13
5.3.10.0050.02912.01
5.3.00.0050.02711.97
5.2.170.0050.02210.48
5.2.160.0050.02010.33
5.2.150.0030.03510.34
5.2.140.0050.03010.20
5.2.130.0030.02110.27
5.2.120.0050.02210.28
5.2.110.0080.02010.32
5.2.100.0030.02210.30
5.2.90.0030.02110.45
5.2.80.0100.02710.40
5.2.70.0080.03010.18
5.2.60.0050.02310.27
5.2.50.0030.02410.21
5.2.40.0020.02710.30
5.2.30.0090.02810.11
5.2.20.0050.02210.03
5.2.10.0080.02010.04
5.2.00.0060.0189.81
5.1.60.0020.0229.32
5.1.50.0110.0139.21
5.1.40.0070.0249.29
5.1.30.0070.0179.52
5.1.20.0050.0189.41
5.1.10.0030.0209.25
5.1.00.0070.0179.15
5.0.50.0030.0158.40
5.0.40.0050.0138.34
5.0.30.0020.0238.29
5.0.20.0090.0138.30
5.0.10.0020.0168.22
5.0.00.0000.0258.08
4.4.90.0030.0117.80
4.4.80.0030.0117.80
4.4.70.0020.0137.80
4.4.60.0020.0147.80
4.4.50.0040.0157.80
4.4.40.0020.0207.80
4.4.30.0030.0147.80
4.4.20.0030.0127.80
4.4.10.0040.0147.80
4.4.00.0020.0207.80
4.3.110.0030.0117.80
4.3.100.0030.0127.80
4.3.90.0070.0087.80
4.3.80.0030.0187.80
4.3.70.0030.0127.80
4.3.60.0000.0197.80
4.3.50.0020.0177.80
4.3.40.0080.0177.80
4.3.30.0010.0137.80
4.3.20.0050.0117.80
4.3.10.0030.0117.80
4.3.00.0070.0127.68

preferences:
56.44 ms | 401 KiB | 5 Q