Q:

Map two dimensional php array to 1 dimension

I have array inside array:
{
"0" => array("key" => "code", "id" => "4", "value" => "yes"),
"1" => array("key" => "parameter", "id" => "4", "value" => "0"),
"2" => array("key" => "code", "id" => "5", "value" => "no"),
etc...
}

This is what I want to do: I want to have one dimension array in which key would be "id" and value would be "value". However, I need to filter out entries whose key is "parameters". So, in this example, the final array should look like this:
{
"4" => "yes",
"5" => "no"
}

I just can't seem to figure out how to do this. Could you please help me a bit? I tried writing this foreach inside foreach but I just can't wrap my head around how to filter data.
foreach ($settings AS $key => $value) {
            $id = null;
            $value = null;

            foreach ($value AS $key2 => $value2) {
                // No idea how to filter out uneccesary entries and save the correct ones
            }

            $finalArray[$id] = $value;
        }

A:

This should do it :
$finalArray = array();
foreach ($settings as $setting) {
    if ($setting['key'] != 'parameter') {
        $finalArray[$setting['id']] = $setting['value'];
    }
}

Assuming all your entries have keys 'key', 'id' and 'value'.

