Heyo! I've never knew this actually but the following method doesn't seem to work properly.
array_push($items[$key], 'price' => 100);
How can I push it in an array so it displays,
{'price':100, 'moredata':1231}
What am I missing?
Heyo! I've never knew this actually but the following method doesn't seem to work properly.
array_push($items[$key], 'price' => 100);
How can I push it in an array so it displays,
{'price':100, 'moredata':1231}
What am I missing?
You can't specify a key with array_push
.
Fortunately, most of the time* when people use array_push
it isn't actually necessary.
$items[$key]['price'] = 100
*at least most of the time in Stack Overflow questions