I have an array that looks like this
Array
(
[0] => Array
(
[Title] => The Title
[Price] => 700
[Quantity] => 2
)
)
Say I wanted to change the Quantity to 5 how would I do that if the array were stored in the variable $ItemArray?
Try
$itemArray[0]['Quantity'] = 5;.Basically, you have an array,
$itemArray, which contains an associative array. To access that inside array, you simply use standard PHP array syntax:$itemArray[0].Then, you need the
Quantityfield of that inner array. Using the nested array syntax, you append['Quantity']to the end of our previous statement, resulting in:$itemArray[0]['Quantity'].At this point, you have the field you want, and you can use the normal
=to set the field value.