webCOMAND

session::get()

Retrieve a session value based on it's key.

Prototype

mixed get(string $key, string $default = NULL)

Parameters

  • key - Name of the session variable to retrieve.  If NULL or no key is provided, an associative array of all parameters will be returned.
  • default - Optional default value to return if the key is not defined.

Return

Returns the value of the session variable that matches the key.  If no variable matches, the specified default is returned, otherwise NULL.

Example

// retrieve the session id
$session = new \io_comand_web\session();
$session_id = $session->get('id');