I have an array as below. I wish to update the value of [form_id] => 79 to [form_id] => 123.
Array
(
[directory_table-columns] => Array
(
[6433fed3e408d] => Array
(
[id] => 20
[label] => Rank
[form_id] => 79
)
[6433ffa1bf847] => Array
(
[content] => <a href="{site_url}/user/{Player:1}">{Player:1}</a>
[label] => Custom Content
[form_id] => 79
)
...
...
Below is my code.
foreach ( $src_gravityview_directory_fields as $key1 => $value1 ) {
foreach ( $value1 as $key2 => &$value2 ) {
$value2['form_id'] = $dest_form_id;
}
}
But the value of form_id doesn’t change. I also tried the below but no joy.
foreach ( $src_gravityview_directory_fields as $key1 => $value1 ) {
foreach ( $value1 as $key2 => $value2 ) {
$value2[$key2]['form_id'] = $dest_form_id;
}
}
I tried this but it caused an infinite loop.