I've had my thinking hat on about this for the last couple of hours
I have two arrays like this:
I have another array like so and this will increase with size with the same key namesPHP Code:Form_Controller::ah_form_fields():
Array
(
[0] => Array
(
[id] => ah_url_name_input
[title] => Give the feed a name here
[desc] => Give your feed a label
[std] =>
[type] => text
[section] => txt_section
[choices] =>
[class] => ah_name
)
[1] => Array
(
[id] => ah_url_input
[title] => Place the fields URL here
[desc] => Place the fields URL here (desc)
[std] =>
[type] => text
[section] => txt_section
[choices] =>
[class] => ah_email
)
)
I want clone the first two and place the values of the $option array in the std key so it will end up like this:PHP Code:$option:
Array
(
[0] => Array
(
[ah_url_name_input] => asdfsdaf
[ah_url_input] => http://support.google.com/websearch/bin/answer.py?hl=en&answer=142143&topic=1221265&ctx=topic
)
)
So I'm going to need to loop through the array like so:PHP Code:
Array
(
[0] => Array
(
[id] => ah_url_name_input
[title] => Give the feed a name here
[desc] => Give your feed a label
[std] => asdfsdaf
[type] => text
[section] => txt_section
[choices] =>
[class] => ah_name
)
[1] => Array
(
[id] => ah_url_input
[title] => Place the fields URL here
[desc] => Place the fields URL here (desc)
[std] => http://support.google.com/websearch/bin/answer.py?hl=en&answer=142143&topic=1221265&ctx=topic
[type] => text
[section] => txt_section
[choices] =>
[class] => ah_email
)
[3] => Array
(
[id] => ah_url_name_input
[title] => Give the feed a name here
[desc] => Give your feed a label
[std] =>
[type] => text
[section] => txt_section
[choices] =>
[class] => ah_name
)
[4] => Array
(
[id] => ah_url_input
[title] => Place the fields URL here
[desc] => Place the fields URL here (desc)
[std] =>
[type] => text
[section] => txt_section
[choices] =>
[class] => ah_email
)
)
Bit confused here about how to integrate the two together.PHP Code:
foreach (Form_Controller::ah_form_fields() as $result) {
foreach ($result as $key => $value) {
if ($result[$key] == "std") {
$result[$value] = //... something here
}
}
}
The "cloning" is easy enough as I'll just save the results into a new array



Reply With Quote

Bookmarks