3v4l.org

run code in 500+ PHP versions simultaneously
<?php global $wpdb; $charset_collate = $wpdb->get_charset_collate(); $phantom_option = $wpdb->prefix . 'phantom_option'; $phantom_menu = $wpdb->prefix . 'phantom_menu'; $wc_all_defult_and_undefult_array = array_keys(wc_get_account_menu_items()); $pa_custom_tab_endpoints = $wpdb->get_results("SELECT pa_menu_endpoint FROM $phantom_menu WHERE pa_menu_from='pa_custom_tab'"); // Extract the values from $pa_custom_tab_endpoints $pa_custom_tab_endpoints_list = array_map(function($item) { return $item->pa_menu_endpoint; }, $pa_custom_tab_endpoints); // Remove the values in $pa_custom_tab_endpoints from $wc_all_defult_and_undefult_array $wc_all_defult_endpoints_array = array_diff($wc_all_defult_and_undefult_array, $pa_custom_tab_endpoints_list); foreach($wc_all_defult_endpoints_array as $wcendpoint){ $result = $wpdb->get_results("select * from $phantom_menu WHERE pa_menu_endpoint='$wcendpoint'"); // if you are only going to use `pa_menu_endpoint`, then don't select everything via * foreach ($result as $row) $row->pa_menu_endpoint; // there is no assignment or usage in this line; this line is doing nothing. if (!$result) { // "if (!$result) {" will never be true here; maybe you intend for this to be: "if (!$row->pa_menu_endpoint) {" $wpdb->query(" INSERT INTO `$phantom_menu` (`pa_menu_endpoint`, `pa_menu_from`) VALUES ('$wcendpoint', 'wc')"); } } }

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.50.0120.00718.56
8.2.40.0090.00917.62
8.2.30.0120.00617.62
8.2.20.0040.01317.62
8.2.10.0110.00617.62
8.2.00.0080.00817.62
8.1.170.0000.01617.62
8.1.160.0120.00517.62
8.1.150.0040.01217.62
8.1.140.0110.00417.62
8.1.130.0110.00517.62
8.1.120.0130.00317.62
8.1.110.0140.00317.62
8.1.100.0150.00017.62
8.1.90.0090.00617.62
8.1.80.0120.00417.62
8.1.70.0120.00317.62
8.1.60.0180.00017.62
8.1.50.0150.00317.62
8.1.40.0120.00717.62
8.1.30.0100.00817.62
8.1.20.0150.00217.62
8.1.10.0140.00417.62
8.1.00.0110.00817.62
8.0.280.0170.00017.62
8.0.270.0100.00517.62
8.0.260.0130.00317.62
8.0.250.0120.00417.62
8.0.240.0130.00317.62
8.0.230.0140.00017.62
8.0.220.0060.00917.62
8.0.210.0100.00517.62
8.0.200.0150.00417.62
8.0.190.0150.00017.62
8.0.180.0110.00517.62
8.0.170.0100.00517.62
8.0.160.0080.00817.62
8.0.150.0120.00417.62
8.0.140.0120.00217.62
8.0.130.0080.00817.62
8.0.120.0120.00417.62
8.0.110.0030.01217.62
8.0.100.0120.00417.62
8.0.90.0070.00717.62
8.0.80.0110.00417.62
8.0.70.0120.00417.62
8.0.60.0080.00817.62
8.0.50.0130.00317.62
8.0.30.0100.00517.62
8.0.20.0150.00017.62
8.0.10.0090.00617.62

preferences:
48.08 ms | 695 KiB | 4 Q