3v4l.org

run code in 300+ PHP versions simultaneously
<?php $tests = array("HIV", "Chlamydia", "Gonorrhoea"); $years = [ '2011' => false, '2012' => false, '2013' => false, '2014' => false, '2015' => false, '2016' => false, '2017' => false ]; $this_year = date('Y'); if (!array_key_exists($this_year, $years)) { // add to the array: $years[$this_year] = false; } $tests_by_year = []; $test_obj = []; $obj_count = count($years); $obj_added = 0; foreach ( $tests as $value ) { foreach ($years as $year => $yval) { $tests_by_year[$value][$year] = 0; if ($obj_added <= $obj_count) { $test_obj[] = new \stdClass; } $obj_added++; } } var_dump($test_obj); $test_obj2 = [ 0 => new \stdClass, 1 => new \stdClass, 2 => new \stdClass, 3 => new \stdClass, 4 => new \stdClass, 5 => new \stdClass, 6 => new \stdClass, 7 => new \stdClass, 8 => new \stdClass, 9 => new \stdClass ]; $test_obj2[0]->y = (int)2011; $test_obj2[1]->y = (int)2012; $test_obj2[2]->y = (int)2013; $test_obj2[3]->y = (int)2014; $test_obj2[4]->y = (int)2015; $test_obj2[5]->y = (int)2016; $test_obj2[6]->y = (int)2017; $test_obj2[7]->y = (int)2018; $test_obj2[8]->y = (int)2019; $test_obj2[9]->y = (int)2020; var_dump($test_obj2); /* foreach ($tests_by_year as $key => $value) { $test_obj[0]->$key = $value['2011']; $test_obj[1]->$key = $value['2012']; $test_obj[2]->$key = $value['2013']; $test_obj[3]->$key = $value['2014']; $test_obj[4]->$key = $value['2015']; $test_obj[5]->$key = $value['2016']; $test_obj[6]->$key = $value['2017']; $test_obj[7]->$key = $value['2018']; $test_obj[8]->$key = $value['2019']; $test_obj[9]->$key = $value['2020']; }*/

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.0060.00918.43
8.3.50.0070.00718.16
8.3.40.0070.00719.10
8.3.30.0060.01319.14
8.3.20.0000.00821.73
8.3.10.0050.00321.91
8.3.00.0030.00619.92
8.2.180.0070.00718.29
8.2.170.0040.01122.96
8.2.160.0200.00020.39
8.2.150.0090.00024.18
8.2.140.0080.00024.66
8.2.130.0060.00319.21
8.2.120.0000.00826.35
8.2.110.0060.00319.15
8.2.100.0070.00417.97
8.2.90.0070.00418.16
8.2.80.0080.00018.16
8.2.70.0000.00818.05
8.2.60.0000.00818.15
8.2.50.0060.00318.16
8.2.40.0050.00320.45
8.2.30.0050.00319.64
8.2.20.0060.00318.28
8.2.10.0000.00818.28
8.2.00.0000.00818.14
8.1.280.0090.00625.92
8.1.270.0040.00422.07
8.1.260.0090.00326.35
8.1.250.0080.00028.09
8.1.240.0030.00622.45
8.1.230.0070.00722.75
8.1.220.0030.00617.84
8.1.210.0040.00418.77
8.1.200.0050.00317.48
8.1.190.0040.00417.35
8.1.180.0030.00518.10
8.1.170.0000.00818.91
8.1.160.0000.00718.87
8.1.150.0040.00419.11
8.1.140.0000.00717.82
8.1.130.0000.00719.10
8.1.120.0040.00417.63
8.1.110.0030.00517.63
8.1.100.0000.00717.55
8.1.90.0050.00317.61
8.1.80.0030.00617.63
8.1.70.0000.00717.68
8.1.60.0000.00817.69
8.1.50.0030.00517.61
8.1.40.0040.00417.45
8.1.30.0040.00417.74
8.1.20.0000.00917.77
8.1.10.0000.00817.48
8.1.00.0090.00317.63
8.0.300.0060.00320.02
8.0.290.0040.00416.75
8.0.280.0000.00718.43
8.0.270.0080.00017.28
8.0.260.0020.00517.41
8.0.250.0000.00717.19
8.0.240.0050.00217.14
8.0.230.0030.00317.06
8.0.220.0050.00317.09
8.0.210.0070.00017.13
8.0.200.0000.00717.10
8.0.190.0000.00717.15
8.0.180.0030.00517.10
8.0.170.0030.00717.00
8.0.160.0000.00717.15
8.0.150.0040.00416.99
8.0.140.0070.00017.01
8.0.130.0000.00513.35
8.0.120.0030.00517.02
8.0.110.0040.00417.00
8.0.100.0070.00017.06
8.0.90.0040.00417.00
8.0.80.0080.00817.06
8.0.70.0000.00816.89
8.0.60.0050.00317.09
8.0.50.0000.00817.09
8.0.30.0080.01017.26
8.0.20.0090.01417.40
8.0.10.0000.00817.30
8.0.00.0070.01516.87
7.4.330.0000.00515.55
7.4.320.0060.00016.63
7.4.300.0030.00316.62
7.4.290.0050.00316.65
7.4.280.0030.00516.68
7.4.270.0030.00316.62
7.4.260.0000.00716.69
7.4.250.0000.00816.68
7.4.240.0070.00016.60
7.4.230.0030.00516.69
7.4.220.0040.00416.61
7.4.210.0090.00716.64
7.4.200.0050.00316.69
7.4.160.0110.01016.66
7.4.140.0120.01017.86
7.4.130.0090.00916.80
7.4.120.0090.01016.79
7.4.110.0140.00716.63
7.4.100.0190.00616.65
7.4.90.0140.00816.69
7.4.80.0100.01319.39
7.4.70.0170.00716.59
7.4.60.0060.01016.40
7.4.50.0100.00316.68
7.4.40.0100.00716.79
7.4.00.0090.00615.21
7.3.330.0000.00513.40
7.3.320.0060.00013.19
7.3.310.0000.00716.42
7.3.300.0030.00316.35
7.3.290.0030.00316.40
7.3.280.0110.00316.44
7.3.260.0190.01216.47
7.3.240.0100.01016.72
7.3.230.0180.00016.89
7.3.210.0080.01216.56
7.3.200.0150.00916.69
7.3.190.0030.01516.48
7.3.180.0070.01116.56
7.3.170.0130.00916.71
7.3.160.0090.00916.52
7.3.00.0070.00716.70
7.2.330.0130.01316.89
7.2.320.0100.01016.67
7.2.310.0080.01116.88
7.2.300.0110.00716.87
7.2.290.0120.00616.90
7.2.130.0160.00316.98
7.2.120.0130.00316.40
7.2.110.0140.00316.84
7.2.100.0070.00716.80
7.2.90.0070.01316.72
7.2.80.0080.00716.82
7.2.70.0090.00316.47
7.2.60.0110.00516.68
7.2.50.0200.00016.83
7.2.40.0580.01217.38
7.2.30.0600.01417.46
7.2.20.0620.00817.47
7.2.10.0450.01117.44
7.2.00.0550.01117.63
7.1.250.0030.01015.83
7.1.240.0080.00315.70
7.1.230.0160.00015.62
7.1.220.0110.00415.54
7.1.210.0060.00615.52
7.1.200.0070.00415.91
7.1.190.0040.01115.59
7.1.180.0070.01315.43
7.1.170.0090.00915.68
7.1.160.0590.00916.23
7.1.150.0480.00916.36
7.1.140.0380.00716.44
7.1.130.0570.01416.31
7.1.120.0420.00816.22
7.1.110.0590.01116.00
7.1.100.0510.01016.19
7.1.90.0350.00816.15
7.1.80.0370.00616.20
7.1.70.0330.01415.48
7.1.60.0510.01424.72
7.1.50.0600.01124.44
7.1.40.0430.01324.10
7.1.30.0220.01724.11
7.1.20.0250.01224.39
7.1.10.0800.00715.25
7.1.00.0090.01115.44
7.0.330.0070.00715.18
5.6.380.0090.00314.43

preferences:
35.79 ms | 400 KiB | 5 Q