When will the session end in php? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

When will the session end in php?

Guys i have a doubt about if we start our webpage with <?php session_start(); ?> For ever user that will generate a special session in browser My question is when will this end? As cookies can be mentioned with time expries when will session end? I tested this and found even if i close the tab its stored?

21st Sep 2020, 7:40 AM
Ananthu SV
Ananthu SV - avatar
8 Answers
+ 2
Session will end in php when you end stop an event like if you close the webpage then the session will end. Depends on your requirements like some session end when the times bound is expire.
22nd Sep 2020, 5:00 PM
HAMID ALI
HAMID ALI - avatar
21st Sep 2020, 7:59 AM
The future is now thanks to science
The future is now thanks to science - avatar
0
Samsil Arefeen but what if the session is not linked with cookies will that vanish after the browser closes?
21st Sep 2020, 8:03 AM
Ananthu SV
Ananthu SV - avatar
21st Sep 2020, 8:07 AM
The future is now thanks to science
The future is now thanks to science - avatar
0
Samsil Arefeen ok thank you ✌️😊
21st Sep 2020, 8:38 AM
Ananthu SV
Ananthu SV - avatar
0
Session ends when u destroy it yourself session_destroy() or if you close your browser and try to access the page again. If you still have access to the website, try clearing your browser session and cookies first and then test it again.
21st Sep 2020, 1:11 PM
Dev
Dev - avatar
0
Dev thank you 😊✌️
21st Sep 2020, 7:24 PM
Ananthu SV
Ananthu SV - avatar
0
HAMID ALI how can we set time limit for session in php?
22nd Sep 2020, 8:18 PM
Ananthu SV
Ananthu SV - avatar