I have a some values in my $_POST that are in there own arrays similar to this,
array(
['conviction_date'] = array(
[0] => 12/01/2011
[1] => 22/12/2011
)
['conviction_description'] = array(
[0] => This some text to show what the conviction was for etc.
[1] => This is some more text to show what the second convication was for
)
)
What I want to know is how do I loop through said arrays so that I can value from one to the match the value of the other via there keys?
Is it as simple as this,
foreach ($_POST['conviction_date'] as $k => $v) {
$newArray[] = array(
'conviction_date' => $v,
'conviction_details' => $_POST['conviction_details'][$k]
)
}
Will this then output something to the following?
array(
[0] => array(
'conviction_date' => 12/01/2011
'conviction_details' => This is some to show what the conviction was for etc.
),
[1] => array()
'conviction_date' => 22/11/2011
'conviction_details' => This is some more text to show what the second convication was for
)
Is there away to build a simpler array?