I have cookie array $cookiearray that contains 3 numbers like that
Array ( [0] => 44 [1] => 57 [2] => 58 )
I goes well and ‘Number 58 found at: 2’
See if removed Array ( [0] => 44 [1] => 57 ) so it was successfully removed.
Then I do setcookie again and I get the old values when I echo it at the end.
Cookie values 44,57,58
Any idea why the cookie is not updated with new values 44,57?
Why setcookie doesn’t work?
You can’t update cookie by unset command. I read you can only set it up again with new values.
That’s the why I haven’t do unset on the cookie but tried to set cookie again with new values.
You should understand that when you call setcookie() it actually affects contents of $_COOKIE array only on the next page load, when cookies will be received again