3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = [.1, .2, .7]; function weightedSelector($input, $value){ foreach ($input as $key => $value){ $total = array_sum($input); $previous = array_sum(array_slice($input, 0, $key)); $percentage = $total - $previous; print_r($total." ".$previous." ".$percentage); if ($value <= $percentage){ return $key; } } } foreach ([.1, .15, .2, .29, .3, .4, .5, .8, .99, .66] as $value){ print_r(weightedSelector($input, $value)." : ".$value); // print_r("\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)
8.3.60.0000.01516.38
8.3.50.0040.01116.25
8.3.40.0070.00718.71
8.3.30.0150.00418.32
8.3.20.0040.00421.77
8.3.10.0030.00523.65
8.3.00.0080.00019.64
8.2.180.0150.00018.06
8.2.170.0030.01422.96
8.2.160.0100.00320.33
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0000.00819.30
8.2.120.0070.00026.35
8.2.110.0070.00421.02
8.2.100.0080.00418.03
8.2.90.0030.00617.72
8.2.80.0040.00417.97
8.2.70.0000.00917.93
8.2.60.0080.00017.80
8.2.50.0040.00418.10
8.2.40.0030.00620.42
8.2.30.0030.00319.41
8.2.20.0000.00718.02
8.2.10.0050.00318.11
8.2.00.0030.00618.09
8.1.280.0070.01425.92
8.1.270.0050.00222.05
8.1.260.0050.00326.35
8.1.250.0040.00428.09
8.1.240.0030.00622.02
8.1.230.0110.00022.82
8.1.220.0030.00617.74
8.1.210.0070.00019.01
8.1.200.0080.00317.35
8.1.190.0060.00317.22
8.1.180.0060.00318.10
8.1.170.0030.00518.84
8.1.160.0040.00418.92
8.1.150.0040.00419.04
8.1.140.0040.00417.56
8.1.130.0030.00719.06
8.1.120.0080.00017.47
8.1.110.0080.00317.44
8.1.100.0050.00217.28
8.1.90.0000.00717.33
8.1.80.0040.00417.47
8.1.70.0030.00317.46
8.1.60.0000.00817.45
8.1.50.0040.00417.50
8.1.40.0030.00617.41
8.1.30.0030.00517.66
8.1.20.0000.00817.48
8.1.10.0030.00617.49
8.1.00.0040.00817.47
8.0.300.0060.00319.63
8.0.290.0040.00416.75
8.0.280.0070.00018.43
8.0.270.0070.00017.24
8.0.260.0030.00319.05
8.0.250.0030.00316.98
8.0.240.0040.00416.82
8.0.230.0070.00016.90
8.0.220.0040.00416.81
8.0.210.0070.00016.88
8.0.200.0030.00316.94
8.0.190.0000.00716.84
8.0.180.0080.00016.91
8.0.170.0040.00416.90
8.0.160.0030.00516.89
8.0.150.0040.00716.70
8.0.140.0040.00416.82
8.0.130.0050.00013.32
8.0.120.0030.00616.74
8.0.110.0040.00416.84
8.0.100.0050.00216.87
8.0.90.0080.00016.70
8.0.80.0060.01216.84
8.0.70.0070.00016.85
8.0.60.0080.00016.77
8.0.50.0000.00816.87
8.0.30.0130.00817.16
8.0.20.0100.01017.40
8.0.10.0040.00416.95
8.0.00.0070.01016.91
7.4.330.0000.00515.55
7.4.320.0000.00716.50
7.4.300.0000.00616.49
7.4.290.0000.00716.41
7.4.280.0080.00016.50
7.4.270.0040.00416.58
7.4.260.0000.00716.46
7.4.250.0070.00316.57
7.4.240.0030.00516.43
7.4.230.0070.00016.32
7.4.220.0080.00016.48
7.4.210.0090.00716.63
7.4.200.0000.00716.47
7.4.160.0080.00716.67
7.4.140.0120.01317.86
7.4.130.0070.01116.59
7.4.120.0110.00916.47
7.4.110.0130.00616.57
7.4.100.0100.01316.34
7.4.90.0060.01216.32
7.4.80.0160.00919.39
7.4.70.0160.00616.49
7.4.60.0100.00716.46
7.4.50.0120.00316.60
7.4.40.0070.01116.35
7.4.00.0070.01114.98
7.3.330.0030.00313.13
7.3.320.0030.00313.20
7.3.310.0030.00316.30
7.3.300.0000.00716.15
7.3.290.0000.00716.34
7.3.280.0070.01016.28
7.3.260.0090.01016.46
7.3.240.0050.01316.53
7.3.230.0080.00816.28
7.3.210.0120.00416.25
7.3.200.0110.01116.59
7.3.190.0040.01316.33
7.3.180.0100.00616.49
7.3.170.0070.01016.54
7.3.160.0160.00016.42
7.3.120.0080.01114.86
7.3.110.0040.01415.07
7.3.100.0070.01014.96
7.3.90.0070.00714.80
7.3.80.0030.01314.44
7.3.70.0060.00614.76
7.3.60.0040.01114.93
7.3.50.0110.00414.47
7.3.40.0080.00814.69
7.3.30.0110.00414.84
7.3.20.0000.01716.69
7.3.10.0030.00716.80
7.3.00.0110.00316.74
7.2.330.0180.00016.80
7.2.320.0070.01016.63
7.2.310.0060.01616.50
7.2.300.0030.02016.36
7.2.290.0090.01516.62
7.2.250.0110.00814.98
7.2.240.0130.00715.35
7.2.230.0060.01315.09
7.2.220.0030.00915.26
7.2.210.0070.00715.06
7.2.200.0030.00915.05
7.2.190.0060.00914.97
7.2.180.0030.01315.03
7.2.170.0100.00715.13
7.2.60.0070.00716.81
7.2.50.0090.00616.61
7.2.40.0600.01218.00
7.2.30.0710.01218.11
7.2.20.0630.01518.13
7.2.10.1180.01118.06
7.2.00.1500.01018.22
7.1.330.0060.00915.84
7.1.320.0070.00315.53
7.1.310.0000.01515.76
7.1.300.0100.00315.57
7.1.290.0070.00715.74
7.1.280.0030.00815.85
7.1.270.0080.00815.81
7.1.260.0090.00615.91
7.1.200.0030.01015.96
7.1.160.0520.01317.00
7.1.150.0700.00916.86
7.1.140.0600.01216.75
7.1.130.1170.01716.90
7.1.120.0850.01016.84
7.1.110.0930.01316.27
7.1.100.0750.00716.32
7.1.90.0890.00716.36
7.1.80.0840.00916.39
7.1.70.0790.01015.48
7.1.60.1500.01433.02
7.1.50.1600.01133.16
7.1.40.1650.01332.54
7.1.30.2060.01432.91
7.1.20.1400.01632.93
7.1.10.1950.01114.68
7.1.00.1000.01614.84

preferences:
106.32 ms | 400 KiB | 5 Q