session_start() & some

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mclarko
Forum Newbie
Posts: 3
Joined: Tue Dec 10, 2002 5:08 am

session_start() & some

Post by mclarko »

Some tutorials say always use session_start() and others will say it doesn't matter - start a session with session_register(). What's the score here?

Can I start a session with just $_SESSION['myVar'] = $SOMEvAL?

Does session_unregister() not work in some intances? Have read you need to use isset() instead? What's this all about then?

Rgds
inn
Forum Newbie
Posts: 8
Joined: Fri Dec 13, 2002 1:21 pm
Location: Malé, Maldives

Sessions

Post by inn »

well its a matter of your choice. if you choose to start the session on every script of your application then it'll be good. my preference is start the session using session_start() and then follow everthing else. i use $_SESSION["variable"] = "value"; to set session variables. once the browser is closed, and is set in most webservers, the session will expire and you can't access unless you know the session id.

once you're done with you session part and you want to finish and cleanup everthing then you can use session_destroy(); to do so.
Post Reply