Convert PHP array into Key => Value Array
- by Feature
Total PHP Noob and I couldn't find an answer to this specific problem. Hope someone can help!
$myvar is an array that looks like this:
Array (
[aid] = Array (
[0] = 2
[1] = 1
)
[oid] = Array(
[0] = 2
[1] = 1
)
)
And I need to set a new variable (called $attributes) to something that looks like this:
$attributes = array($myvar['aid'][0] => $myvar['oid'][0], $myvar['aid'][1] => $myvar['oid'][1], etc...);
And, of course, $myvar may contain many more items...
How do I iterate through $myvar and build the $attributes variable?