3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $row = array ( 'COUNTRY_NAME' => 'Austria', 'SUPPLIES_1' => ' 99 039', 'SUPPLIES_1_RAW_DATA' => '99039.1813475', 'SUPPLIES_2' => ' 513 278', 'SUPPLIES_2_RAW_DATA' => '513277.578759', 'SUPPLIES_3' => ' 158 135', 'SUPPLIES_3_RAW_DATA' => '158134.8060437', 'SUPPLIES_4' => ' 124 668', 'SUPPLIES_4_RAW_DATA' => '124668.2270189', 'SUPPLIES_5' => ' 1 078 719', 'SUPPLIES_5_RAW_DATA' => '1078719.4398201', 'SUPPLIES_6' => ' 531 612', 'SUPPLIES_6_RAW_DATA' => '531611.7664429', 'SUPPLIES_7' => ' 159 595', 'SUPPLIES_7_RAW_DATA' => '159595', 'SUPPLIES_8' => ' 1 368 777', 'SUPPLIES_8_RAW_DATA' => '1368777.4982794', 'SUPPLIES_9' => ' 28 545', 'SUPPLIES_9_RAW_DATA' => '28544.5166573', 'SUPPLIES_TOTAL' => ' 4 062 368', 'SUPPLIES_TOTAL_RAW_DATA' => '4062368.0143688', 'SUPPLIES_RATIO' => ' 0.52', 'SUPPLIES_RATIO_RAW_DATA' => '0.52441779260597', 'IR_PREV_YEAR' => '0.51', ); $filtered_keys = array ( 2 => 'SUPPLIES_1_RAW_DATA', 4 => 'SUPPLIES_2_RAW_DATA', 6 => 'SUPPLIES_3_RAW_DATA', 8 => 'SUPPLIES_4_RAW_DATA', 10 => 'SUPPLIES_5_RAW_DATA', 12 => 'SUPPLIES_6_RAW_DATA', 14 => 'SUPPLIES_7_RAW_DATA', 16 => 'SUPPLIES_8_RAW_DATA', 18 => 'SUPPLIES_9_RAW_DATA', 20 => 'SUPPLIES_TOTAL_RAW_DATA', 22 => 'SUPPLIES_RATIO_RAW_DATA', ); $filtered_row = array_intersect_key($row, array_flip($filtered_keys)); print_r($filtered_row);
based on FdiTb
Output for 5.1.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Array ( [SUPPLIES_1_RAW_DATA] => 99039.1813475 [SUPPLIES_2_RAW_DATA] => 513277.578759 [SUPPLIES_3_RAW_DATA] => 158134.8060437 [SUPPLIES_4_RAW_DATA] => 124668.2270189 [SUPPLIES_5_RAW_DATA] => 1078719.4398201 [SUPPLIES_6_RAW_DATA] => 531611.7664429 [SUPPLIES_7_RAW_DATA] => 159595 [SUPPLIES_8_RAW_DATA] => 1368777.4982794 [SUPPLIES_9_RAW_DATA] => 28544.5166573 [SUPPLIES_TOTAL_RAW_DATA] => 4062368.0143688 [SUPPLIES_RATIO_RAW_DATA] => 0.52441779260597 )
Output for 5.0.0 - 5.0.5
Fatal error: Call to undefined function array_intersect_key() in /in/SuRWt on line 4
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: array_intersect_key() in /in/SuRWt on line 4
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: array_intersect_key() in /in/SuRWt on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: array_intersect_key() in /in/SuRWt on line 4