If I have a serialized array... how can I append more values to it? Should I unserialize it first -> add data and then serialize it again?
Yes.
function addItem($serializedArray, $item)
{
$a = unserialize($serializedArray);
$a[] = $item;
return serialize($a);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With