I need to convert a PHP array that I'm getting from a form submission, so that I can use it more usefully in a db.
Array
(
[first_name] => Array
(
[0] => Ben
[1] => Tom
[2] => Sarah
)
[last_name] => Array
(
[0] => Wills
[1] => Main
[2] => Bliss
)
[email] => Array
(
[0] => ben.wills@argh.com
[1] => tommain@argh.com
[2] => sbliss@argh.com
)
)
to:
Array
(
[0] => Array
(
[first_name] => Ben
[last_name] => Wills
[email] => ben.wills@argh.com
)
[1] => Array
(
[first_name] => Tom
[last_name] => Main
[email] => tommain@argh.com
)
[2] => Array
(
[first_name] => Sarah
[last_name] => Bliss
[email] => sbliss@argh.com
)
)
How can I change the values' key paths so that the first level keys and the second level keys are swapped?