1

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?

jim
  • 13
  • 2
  • possible duplicate of [Accessing $_COOKIE immediately after setcookie()](http://stackoverflow.com/questions/3230133/accessing-cookie-immediately-after-setcookie) – outis Mar 25 '12 at 19:57

1 Answers1

5

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.

awm
  • 6,526
  • 25
  • 24
  • 1
    AWM, I'll credit you for your answer when the 8 minute time constraint expires. – jim Feb 15 '11 at 08:57