3v4l.org

run code in 300+ PHP versions simultaneously
<?php function myRand($max){ do{ $result = floor($max*(hexdec(bin2hex(openssl_random_pseudo_bytes(4)))/0xffffffff)); }while($result == $max); return $result; } echo myRand(1000);

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.0090.00916.75
8.3.60.0000.01418.43
8.3.50.0120.01016.57
8.3.40.0000.01518.77
8.3.30.0070.00718.66
8.3.20.0040.00421.79
8.3.10.0040.00421.95
8.3.00.0050.00319.80
8.2.190.0150.00716.58
8.2.180.0040.01816.63
8.2.170.0140.00722.96
8.2.160.0100.00319.34
8.2.150.0040.00424.18
8.2.140.0060.00324.66
8.2.130.0190.00026.16
8.2.120.0040.00420.22
8.2.110.0100.00018.04
8.2.100.0060.00619.45
8.2.90.0090.00017.62
8.2.80.0050.00318.61
8.2.70.0030.00517.50
8.2.60.0060.00317.50
8.2.50.0080.00017.63
8.2.40.0080.00020.47
8.2.30.0000.00719.25
8.2.20.0050.00317.87
8.2.10.0040.00417.87
8.2.00.0020.00518.05
8.1.280.0070.00725.92
8.1.270.0040.00423.91
8.1.260.0040.00426.35
8.1.250.0050.00328.09
8.1.240.0060.00322.13
8.1.230.0080.00420.88
8.1.220.0000.00817.74
8.1.210.0080.00018.77
8.1.200.0080.00017.41
8.1.190.0060.00317.10
8.1.180.0030.00618.10
8.1.170.0080.00018.56
8.1.160.0080.00018.68
8.1.150.0050.00318.76
8.1.140.0030.00619.43
8.1.130.0070.00017.33
8.1.120.0000.00717.22
8.1.110.0000.00817.35
8.1.100.0000.00817.38
8.1.90.0070.00017.30
8.1.80.0000.00817.38
8.1.70.0080.00017.33
8.1.60.0000.00817.48
8.1.50.0080.00017.45
8.1.40.0030.00617.43
8.1.30.0040.00417.59
8.1.20.0000.00817.63
8.1.10.0100.00017.46
8.1.00.0000.00717.45
8.0.300.0000.00718.77
8.0.290.0000.00716.75
8.0.280.0000.00718.34
8.0.270.0030.00317.19
8.0.260.0050.00316.78
8.0.250.0030.00316.97
8.0.240.0000.00916.85
8.0.230.0030.00316.99
8.0.220.0070.00016.91
8.0.210.0030.00316.93
8.0.200.0000.00616.96
8.0.190.0050.00517.02
8.0.180.0000.00716.93
8.0.170.0040.00416.87
8.0.160.0030.00316.87
8.0.150.0040.00316.78
8.0.140.0050.00316.80
8.0.130.0030.00313.38
8.0.120.0000.00716.74
8.0.110.0040.00416.86
8.0.100.0030.00616.89
8.0.90.0040.00416.89
8.0.80.0130.00316.93
8.0.70.0040.00416.94
8.0.60.0030.00516.95
8.0.50.0030.00516.70
8.0.30.0090.01016.99
8.0.20.0130.00917.40
8.0.10.0040.00416.97
8.0.00.0050.01116.68
7.4.330.0060.00015.55
7.4.320.0000.00616.39
7.4.300.0030.00316.53
7.4.290.0000.00716.55
7.4.280.0030.00516.47
7.4.270.0030.00316.44
7.4.260.0030.00316.47
7.4.250.0000.00716.43
7.4.240.0030.00316.35
7.4.230.0090.00016.42
7.4.220.0100.01016.45
7.4.210.0110.00716.52
7.4.200.0030.00316.64
7.4.160.0080.01016.50
7.4.150.0170.00317.40
7.4.140.0130.01117.86
7.4.130.0250.00016.57
7.4.120.0120.01216.54
7.4.110.0120.01216.53
7.4.100.0000.01716.37
7.4.90.0160.00016.64
7.4.80.0040.01319.39
7.4.70.0100.00616.66
7.4.60.0090.00616.47
7.4.50.0070.01016.46
7.4.40.0070.00816.16
7.4.30.0180.00316.58
7.4.00.0070.01014.93
7.3.330.0000.00613.16
7.3.320.0030.00213.30
7.3.310.0030.00316.36
7.3.300.0070.00016.20
7.3.290.0030.00316.17
7.3.280.0090.00916.32
7.3.270.0130.00917.40
7.3.260.0050.01516.54
7.3.250.0080.01116.40
7.3.240.0140.00516.43
7.3.230.0090.00916.45
7.3.210.0070.01016.47
7.3.200.0090.00616.59
7.3.190.0140.00316.59
7.3.180.0130.00316.26
7.3.170.0030.01416.34
7.3.160.0150.00316.37
7.3.120.0050.01114.76
7.3.110.0070.00814.60
7.3.100.0030.01014.83
7.3.90.0050.01014.90
7.3.80.0030.01114.93
7.3.70.0070.00714.84
7.3.60.0080.00514.71
7.3.50.0070.00514.75
7.3.40.0050.01014.79
7.3.30.0080.00714.75
7.3.20.0060.00616.66
7.3.10.0050.00816.36
7.3.00.0070.01016.60
7.2.330.0070.01016.71
7.2.320.0100.00616.55
7.2.310.0100.00716.27
7.2.300.0100.00716.25
7.2.290.0100.00616.64
7.2.250.0070.01014.75
7.2.240.0050.01014.79
7.2.230.0060.00914.91
7.2.220.0060.00614.75
7.2.210.0050.01014.93
7.2.200.0020.01314.80
7.2.190.0090.00714.87
7.2.180.0080.00514.89
7.2.170.0090.00414.95
7.2.160.0130.00315.05
7.2.150.0030.01016.93
7.2.140.0030.01016.60
7.2.130.0090.00616.87
7.2.120.0060.01016.52
7.2.110.0000.01816.72
7.2.100.0070.00716.42
7.2.90.0030.01316.69
7.2.80.0040.01216.41
7.2.70.0060.00616.64
7.2.60.0060.01016.71
7.2.50.0090.00616.71
7.2.40.0040.00716.77
7.2.30.0030.01316.51
7.2.20.0070.00416.46
7.2.10.0130.00016.50
7.2.00.0030.01616.80
7.1.330.0080.00815.63
7.1.320.0070.00815.51
7.1.310.0030.00915.63
7.1.300.0050.00915.49
7.1.290.0020.01015.50
7.1.280.0060.00715.62
7.1.270.0050.00615.65
7.1.260.0070.00515.57
7.1.250.0070.00415.68
7.1.100.4460.01315.98
7.1.90.7450.00315.95
7.1.80.6720.01316.09
7.1.70.2070.00516.71
7.1.60.1620.01225.80
7.1.50.1690.01625.72
7.1.40.1390.00925.34
7.1.30.1580.00925.50
7.1.20.1330.01125.46
7.1.10.1090.00616.41
7.1.00.0880.00816.45
7.0.240.4600.00715.75
7.0.230.5090.00715.78
7.0.220.6160.00715.77
7.0.210.3930.00714.94
7.0.200.2070.00816.64
7.0.190.1860.00516.45
7.0.180.1390.01016.31
7.0.170.1170.00916.41
7.0.160.1360.01016.39
7.0.150.2260.01116.34
7.0.140.1130.01516.33
7.0.130.0820.00716.39
7.0.120.0680.00816.43
7.0.110.0150.00616.40
7.0.100.0900.00216.45
7.0.90.0630.01116.42
7.0.80.0600.01116.37
7.0.70.0300.00816.32
7.0.60.0280.00516.35
7.0.50.0430.01116.35
7.0.40.1020.00616.54
7.0.30.0080.00616.52
7.0.20.0030.01016.50
7.0.10.0710.00516.53
7.0.00.0080.00816.52
5.6.300.0080.04820.81
5.6.290.0060.05620.88
5.6.280.0120.05820.95
5.6.270.0050.05921.01
5.6.260.0070.06520.81
5.6.250.0170.05220.93
5.6.240.0050.05520.95
5.6.230.0070.06120.94
5.6.220.0120.05420.84
5.6.210.0130.04220.99
5.6.200.0070.06720.91
5.6.190.0090.05120.88
5.6.180.0050.05420.85
5.6.170.0080.04921.00
5.6.160.0030.05020.88
5.6.150.0090.04921.01
5.6.140.0090.06021.05
5.6.130.0070.04820.81
5.6.120.0120.05220.86
5.6.110.0110.04720.83
5.6.100.0070.05220.81
5.6.90.0050.05220.91
5.6.80.0140.03820.38
5.6.70.0020.05120.31
5.6.60.0100.05720.23
5.6.50.0080.04320.18
5.6.40.0050.04820.28
5.6.30.0110.04620.19
5.6.20.0030.05420.11
5.6.10.0070.04920.26
5.6.00.0050.05020.18
5.5.380.0140.05217.51
5.5.370.0140.05117.47
5.5.360.0030.06217.50
5.5.350.0090.05317.39
5.5.340.0130.05718.03
5.5.330.0170.06017.99
5.5.320.0100.05618.13
5.5.310.0100.05518.11
5.5.300.0130.05217.77
5.5.290.0070.05917.76
5.5.280.0140.07518.12
5.5.270.0030.06318.08
5.5.260.0070.05917.79
5.5.250.0130.05617.91
5.5.240.0150.04517.40
5.5.230.0100.05417.51
5.5.220.0160.06217.15
5.5.210.0100.05117.15
5.5.200.0170.04617.36
5.5.190.0260.04017.48
5.5.180.0080.05617.44
5.5.160.0100.05117.11
5.5.150.0070.05617.29
5.5.140.0130.05117.28
5.5.130.0100.05117.15
5.5.120.0150.04517.41
5.5.110.0140.04817.38
5.5.100.0110.05317.06
5.5.90.0120.06117.25
5.5.80.0070.05317.34
5.5.70.0100.05217.34
5.5.60.0140.04717.27
5.5.50.0030.05817.36
5.5.40.0120.04717.24
5.5.30.0070.05417.35
5.5.20.0230.04217.37
5.5.10.0170.04717.25
5.5.00.0100.05117.36
5.4.450.0100.05819.24
5.4.440.0070.06019.32
5.4.430.0040.05819.21
5.4.420.0140.04819.36
5.4.410.0000.06019.36
5.4.400.0140.04618.98
5.4.390.0160.04519.24
5.4.380.0000.06218.95
5.4.370.0030.05718.89
5.4.360.0030.05819.00
5.4.350.0000.06319.06
5.4.340.0200.04619.08
5.4.320.0120.05518.93
5.4.310.0130.05118.95
5.4.300.0090.05418.93
5.4.290.0090.05318.91
5.4.280.0080.05519.08
5.4.270.0310.04419.02
5.4.260.0220.05718.95
5.4.250.0030.06019.18
5.4.240.0070.05319.07
5.4.230.0150.04618.99
5.4.220.0100.05619.07
5.4.210.0030.05919.00
5.4.200.0160.05318.89
5.4.190.0070.05418.89
5.4.180.0070.05618.89
5.4.170.0170.04418.91
5.4.160.0100.05019.22
5.4.150.0100.05319.22
5.4.140.0140.04916.70
5.4.130.0100.04716.64
5.4.120.0100.05016.36
5.4.110.0100.04816.53
5.4.100.0110.04716.42
5.4.90.0030.05216.72
5.4.80.0150.04716.63
5.4.70.0110.04916.40
5.4.60.0110.05316.62
5.4.50.0200.04616.60
5.4.40.0030.05416.75
5.4.30.0260.03316.61
5.4.20.0070.05116.39
5.4.10.0130.04716.39
5.4.00.0070.05516.15
5.3.290.0070.06114.78
5.3.280.0060.05414.87
5.3.270.0170.04414.88
5.3.260.0100.05114.87
5.3.250.0070.05114.88
5.3.240.0130.04614.65
5.3.230.0090.05014.77
5.3.220.0070.05114.56
5.3.210.0170.04314.84
5.3.200.0130.04614.61
5.3.190.0130.04614.56
5.3.180.0100.04714.61
5.3.170.0060.07614.68
5.3.160.0140.04414.84
5.3.150.0060.05214.84
5.3.140.0120.04614.60
5.3.130.0150.04614.76
5.3.120.0120.04914.59
5.3.110.0120.04814.73
5.3.100.0130.04914.30
5.3.90.0100.05314.29
5.3.80.0070.05314.23
5.3.70.0070.05514.01
5.3.60.0100.06414.29
5.3.50.0220.05214.20
5.3.40.0220.05114.14
5.3.30.0100.06714.09
5.3.20.0100.06213.75
5.3.10.0030.05113.93
5.3.00.0070.04913.93
5.2.170.0180.04511.31
5.2.160.0030.05811.14
5.2.150.0040.06211.44
5.2.140.0140.04811.21
5.2.130.0100.05411.38
5.2.120.0030.04711.38
5.2.110.0070.03911.09
5.2.100.0090.03711.32
5.2.90.0070.04011.21
5.2.80.0120.03711.39
5.2.70.0070.04011.08
5.2.60.0180.05011.13
5.2.50.0090.03811.23
5.2.40.0070.03711.02
5.2.30.0130.03210.96
5.2.20.0040.04211.15
5.2.10.0030.04211.03
5.2.00.0030.04210.91
5.1.60.0060.0329.97
5.1.50.0070.03110.14
5.1.40.0070.0339.87
5.1.30.0060.03510.50
5.1.20.0000.04210.40
5.1.10.0030.03610.33
5.1.00.0140.02710.15
5.0.50.0000.0328.86
5.0.40.0090.0228.29
5.0.30.0030.0428.52
5.0.20.0070.0238.24
5.0.10.0070.0248.27
5.0.00.0070.0388.36
4.4.90.0100.0257.10
4.4.80.0030.0247.10
4.4.70.0000.0247.10
4.4.60.0080.0177.10
4.4.50.0060.0187.10
4.4.40.0040.0337.10
4.4.30.0060.0187.10
4.4.20.0070.0187.10
4.4.10.0060.0237.10
4.4.00.0100.0267.10
4.3.110.0060.0197.10
4.3.100.0030.0217.10
4.3.90.0130.0107.10
4.3.80.0070.0287.10
4.3.70.0030.0207.10
4.3.60.0000.0247.10
4.3.50.0060.0187.10
4.3.40.0030.0317.10
4.3.30.0000.0247.10
4.3.20.0000.0237.10
4.3.10.0030.0207.10
4.3.00.0070.0187.10

preferences:
19.59 ms | 401 KiB | 5 Q