Create an array from a complex array

I have an array that is

key1 
[0] = true
[1] = value
Key2
[0] = true
[1] = value
etc

I would like to read that into another array and end up with

key1 => value
key2 => value

with the key values being the same, non-numeric key names as the original array. I suspect this is possible but not sure how to go about it. Thanks

Hi.

You can make simple loop:

$original = array('key1' => array(true, 'value'), 'key2' => array(true, 'value'));
$new = array();    

foreach($original as $key => $subArray){
    $new[$key] = $subArray[1];
}

Hope it is what you asked about

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.