- what is the default expire time for a cookie if i dont set the expire parameter?
when you close the browser
- If i set a cookie to expire in 20min and 5min later i refresh the page will the cookie expire in 15min or in another 20min?
when you send a cookie, it's stored in the local client machine. The data for the expire time is like "day month year min:secs". If you refresh, the cookie don't 'refresh' the expire time; this die in 15 min. If you want to refresh the cookie, you must kill the old cookie and set a new one.
- Is it possible to use cookie like a session? where the cookie expire when the user close the browser?
in fact, when you use session_start(); and then session_id();, if the browser likes, it can store a cookie named PHPSESSID, telling the expire time that is when the client close the browser. YOU can use cookies for sessions; YOU control the expire time. If you dont set it, it assume the cookie dies when the client close the browser.
PS: sorry for my poor english 😛