3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* assuming you MUST start with your json string, here's my review: * $i is a useless declaration. You don't use it, so lose it. * Initialise the $options array by populating it with parent::getOptions(). * In html, when an <option> tag has identical values in its value attribute and its text, the value attribute can be safely removed without any consequence to form or js behaviours. * I am going to assume/hope that the value element is not required to populate an option tag. * See you on Tuesday for https://www.meetup.com/Joomla-Users-Group-Brisbane/events/xggwjrybcjbvb/ */ // COMPLETELY THEORETICAL / UNTESTED... public function getOptions() { $json = '{"items":[{"aliases":["http://www.stackoverflow.com","http://facebook.stackoverflow.com"],"api_site_parameter":"meta.stackoverflow"~}'; $sites = json_decode($json, true); $options = parent::getOptions(); foreach($sites['items'] as $site) { $options[] = ['text' => $site['api_site_parameter']]; } return $options; }

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.60.0070.01316.10
7.4.50.0090.00916.04
7.4.40.0090.00916.28
7.4.30.0160.00616.13
7.4.20.0070.01316.20
7.4.10.0130.00816.17
7.4.00.0060.01216.57
7.3.180.0190.00416.13
7.3.170.0130.00315.97
7.3.160.0100.01016.20
7.3.150.0160.00316.14
7.3.140.0130.00915.92
7.3.130.0000.01716.23
7.3.120.0130.00816.01
7.3.110.0090.00916.06
7.3.100.0070.01716.23
7.3.90.0030.01316.16
7.3.80.0150.00616.06
7.3.70.0070.01016.16
7.3.60.0130.00316.11
7.3.50.0150.00316.27
7.3.40.0160.00616.21
7.3.30.0060.00916.04
7.3.20.0150.00316.29
7.3.10.0060.01216.13
7.3.00.0060.01216.23
7.2.310.0210.00316.20
7.2.300.0100.00716.45
7.2.290.0170.00016.07
7.2.280.0130.00916.22
7.2.270.0110.01216.14
7.2.260.0100.01316.60
7.2.250.0090.00916.13
7.2.240.0060.01216.45
7.2.230.0070.01416.48
7.2.220.0100.01316.14
7.2.210.0090.01516.17
7.2.200.0130.00416.26
7.2.190.0140.00316.11
7.2.180.0080.01216.36
7.2.170.0120.00616.38
7.2.160.0090.00916.48
7.2.150.0170.00716.31
7.2.140.0140.00716.36
7.2.130.0160.00816.20
7.2.120.0170.00716.28
7.2.110.0100.01316.28
7.2.100.0030.02016.34
7.2.90.0130.01016.21
7.2.80.0090.00916.29
7.2.70.0100.00916.41
7.2.60.0090.00916.33
7.2.50.0140.01116.08
7.2.40.0210.00316.29
7.2.30.0100.01016.27
7.2.20.0100.00716.45
7.2.10.0150.00316.27
7.2.00.0090.00916.34

preferences:
150.25 ms | 1394 KiB | 7 Q