$_SESSION['user']->getURL()
Is it to call the method of getURL() of object $_SESSION['user']?
$_SESSION['user']->getURL()
Is it to call the method of getURL() of object $_SESSION['user']?
You can't really store objects in a session
I stand corrected:
You can store objects in the session... as long as the class is loaded (or can be autolated) by the time session_start() is called.
or you need to serialize and unserialize them in order to use them in a session.
You might also need a __wakeup
function if the class requires a database connection.
http://php.net/manual/en/function.serialize.php
http://php.net/manual/en/function.unserialize.php
[edit]
You probably shouldn't be storing the user object in the session, possibly just an identifier so you can reinstantiate the user object when the page loads (that way the password is not stored in the $_SESSION
if it is in the user object)
Is it to call the method of getURL() of object $_SESSION['user']?
Yes, that is how you would do it.
It retrieves the object stored in $_SESSION['user']
and calls its getURL
method with no arguments.