What happens to a cookie when it reaches its maximum size?

Discussion in 'PHP' started by misterdh, Aug 2, 2010.

  1. #1
    Hi

    I just woundering what happens to a cookie if it reaches its maximum size?

    If I have the following data in a cookie and that is the maximum:

    1, 2, 3, 4, 5, 6, 7, 8
    PHP:
    What will then happen if I add "9"?

    Will it replace the first one like

    2, 3, 4, 5, 6, 7, 8, 9
    PHP:
    Or will it just do nothing and stay at

    1, 2, 3, 4, 5, 6, 7, 8
    PHP:
    Thanks
     
    misterdh, Aug 2, 2010 IP
  2. flexdex

    flexdex Peon

    Messages:
    104
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    The maximum size of a cookie is 4k. Some browsers accept more that 4k, some not. The behavior what happens when you exceed that limit depends to the browser and you should consider storing that data at your own database instead of using one of the users browsers.
     
    flexdex, Aug 4, 2010 IP