I have an array and I wish to update the values in roomTotalPrice. However when I loop, it changes to just a variable.
Array I want to change:
Array
(
[10] => Array
(
[12] => Array
(
[num_rooms] => 2
[adults] => Array
(
[0] => 2
[1] => 2
)
[prices] => Array
(
[0] => 44.5
[1] => 44.5
)
[roomTotalPrice] => Array
(
[0] => 44.5
[1] => 44.5
)
[price] => 178
[supp] => 0
)
)
Code I am using:
//Total Room Price
foreach($iroom['roomTotalPrice'] as $irt){
$s_rate[$iraid][$iroid]['roomTotalPrice'] = 100;
}
Array
(
[10] => Array
(
[12] => Array
(
[num_rooms] => 2
[adults] => Array
(
[0] => 2
[1] => 2
)
[prices] => Array
(
[0] => 44.5
[1] => 44.5
)
[roomTotalPrice] => 100
[price] => 178
[supp] => 0
)
)
Use this code:
Anyway this code is based on the fact that $iroom[‘roomTotalPrice’] loop on the right sub-array as you have written.