Can anyone please tell why this code doesn’t work:
$ser = array('one','two','three','four');
$x = serialize($ser);
$x = unserialize($x);
$x = array_push($x, 'five');
$x = serialize($x);
echo $x;
I think it doesn’t require any further explanation…
The result is only:
i:5;
Dont assign the result of array_push to $x.
This function returns the new number of elements, which you don’t want to replace your array.