I’m attempting to set a cookie but the behavior isn’t what I’m expecting. I’m thinking that a cookie is much like a session in that the array value will be made immediately available. In the case of this cookie that I’ve set, the value isn’t available immediately and I need to refresh my browser one time to get the value. Is this right?
Share
Yes, that’s right.
When you set the cookie, you’re sending it to the client. It’s not available in the $_COOKIE array until the client sends it back to the server — in other words not until the next page load.