I am having trouble finding the right function for this.
I have a session array
$_SESSION['cart_items'][0] = (
'item_name'=>'some name',
'item_price'=>'29.99',
...
)
I need to append another array that has a specific key. The array is from a $_POST object.
$_POST['copy'] = array (
'name'=>'my name',
'office'=>'my office'
)
Appended session to look like this.
$_SESSION['cart_items'][0] = (
'item_name'=>'some name',
'item_price'=>'29.99',
...
'copy'=>array(
'name'=>'my name',
'office'=>'my office'
)
)
I tried array push but this gives me an indexed key for the appended array instead of 'copy'
I know the index of the parent array so i could create the new sub array and then loop the $_POST into it but that doesn't seem right either.