I’ve an array as follows named $test_package_data
. For the reference I’m printing first two elements of it:
Now I want to add a new key-value pair named [count] => '$some_value'
in this array in every element after the key-value pair [test_pack_purchase_date]
(say after [test_pack_purchase_date] => 255
. How should I do this? Can anyone help me in this regard? Thanks in advance.
If you are creating new array then try this :
$arr = array("key" => "value");
And if array is already created then try this :
$arr["key"] = "value";
Answer:
Answer:
Try this:
Tags: phpphp