3v4l.org

run code in 300+ PHP versions simultaneously
<?php for($i=$x=0; $i<=500000; ++$i){ $limits_and_values[$x+=rand(1,10)]=$i; } $start = microtime(true); print "weighted sum is $x\n"; $pick=mt_rand(1,$x); // pull random integer between 1 and highest limit/key while(!isset($limits_and_values[$pick])){++$pick;} // smallest possible loop to find key $end = microtime(true); print "selected value is: $limits_and_values[$pick]\n"; print "total time is " . ($end - $start) . "\n";

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.0260.08236.05
7.4.00.0310.08436.39
7.3.130.0130.08336.64
7.3.120.0300.08336.51
7.3.110.0250.07036.20
7.3.100.0180.07036.41
7.3.90.0320.06636.44
7.3.80.0280.06136.34
7.3.70.0220.05136.44
7.3.60.0280.04636.26
7.3.50.0170.06236.31
7.3.40.0200.05136.44
7.3.30.0220.05136.30
7.3.20.0130.05038.63
7.3.10.0380.04838.59
7.3.00.0100.05038.59
7.2.260.0130.07734.20
7.2.250.0250.08334.22
7.2.240.0170.08834.24
7.2.230.0230.07334.29
7.2.220.0230.07734.38
7.2.210.0330.06034.15
7.2.200.0190.07234.29
7.2.190.0170.06634.22
7.2.180.0150.06834.24
7.2.170.0230.07534.34
7.2.160.0200.06134.02
7.2.150.0070.06336.71
7.2.140.0100.05436.82
7.2.130.0060.05736.59
7.2.120.0100.07336.98
7.2.110.0070.06036.97
7.2.100.0030.06136.98
7.2.90.0160.05636.75
7.2.80.0060.08336.86
7.2.70.0030.05936.99
7.2.60.0160.06636.88
7.2.50.0160.06136.85
7.2.40.0100.05036.89
7.2.30.0030.06236.55
7.2.20.0070.07336.91
7.2.10.0200.04637.01
7.2.00.0100.07537.98
7.1.330.0080.09735.83
7.1.320.0120.11135.87
7.1.310.0100.12335.80
7.1.300.0080.11635.74
7.1.290.0150.09735.63
7.1.280.0070.12835.67
7.1.270.0120.11635.84
7.1.260.0050.11235.48
7.1.250.0070.10335.92
7.1.240.0030.13235.54
7.1.230.0100.10035.82
7.1.220.0130.11535.91
7.1.210.0070.12335.69
7.1.200.0030.10135.75
7.1.190.0070.11335.66
7.1.180.0100.11835.93
7.1.170.0100.10135.66
7.1.160.0070.11735.82
7.1.150.0100.09835.75
7.1.140.0070.10635.51
7.1.130.0170.12035.91
7.1.120.0170.09735.68
7.1.110.0140.12335.58
7.1.100.0030.10235.67
7.1.90.0130.09635.92
7.1.80.0100.09435.95
7.1.70.0120.09936.60
7.1.60.0100.09136.68
7.1.50.0100.11436.38
7.1.40.0570.15344.70
7.1.30.0380.10744.64
7.1.20.0430.11144.54
7.1.10.0280.11735.55
7.1.00.0280.11235.47
7.0.330.0100.12035.48
7.0.320.0030.10935.18
7.0.310.0070.12135.10
7.0.300.0070.10335.27
7.0.290.0030.10835.40
7.0.280.0030.10435.45
7.0.270.0200.12535.38
7.0.260.0030.13635.36
7.0.250.0070.10035.39
7.0.240.0000.12535.35
7.0.230.0130.13835.54
7.0.220.0200.09235.45
7.0.210.0130.08935.41
7.0.200.0150.08136.10
7.0.190.0100.11435.41
7.0.180.0500.15135.23
7.0.170.0330.11435.27
7.0.160.0320.10935.24
7.0.150.0330.09635.15
7.0.140.0400.12235.21
7.0.130.0280.10635.27
7.0.120.0250.11435.46
7.0.110.0320.13435.15
7.0.100.0270.11035.24
7.0.90.0300.10735.24
7.0.80.0420.12535.43
7.0.70.0300.13235.21
7.0.60.0350.13435.17
7.0.50.0300.12935.32
7.0.40.0300.12233.48
7.0.30.1230.10733.30
7.0.20.0330.13233.37
7.0.10.0270.12133.28
7.0.00.0260.12033.23
5.6.400.0200.22879.19
5.6.390.0370.22079.27
5.6.380.0230.24478.88
5.6.370.0300.22079.12
5.6.360.0270.24978.53
5.6.350.0330.22679.10
5.6.340.0370.20978.71
5.6.330.0300.26878.96
5.6.320.0270.26079.30
5.6.310.0230.25878.96
5.6.300.0400.24778.64
5.6.290.0330.22379.00
5.6.280.0200.23879.31
5.6.270.0330.24578.86
5.6.260.0340.25679.17
5.6.250.0520.21679.09
5.6.240.0270.23879.30
5.6.230.0360.22078.97
5.6.220.0510.24479.04
5.6.210.0170.28679.29
5.6.200.0200.24378.81
5.6.190.0330.25178.83
5.6.180.0430.26079.28
5.6.170.0230.27278.80
5.6.160.0340.21178.89
5.6.150.0270.28278.78
5.6.140.0170.24179.12
5.6.130.0470.27379.17
5.6.120.0400.24178.91
5.6.110.0430.21378.95
5.6.100.0430.25979.23
5.6.90.0300.25679.08
5.6.80.0360.28879.07
5.6.70.0200.30578.88
5.6.60.0430.30178.95
5.6.50.0550.27178.66
5.6.40.0300.25178.84
5.6.30.0300.24678.73
5.6.20.0230.22178.89
5.6.10.0260.23478.91
5.6.00.0330.20778.88

preferences:
65.22 ms | 403 KiB | 5 Q