webCOMAND

session::set()

Set or update a session value based on it's name.

Prototype

boolean set(string $key, mixed $value)

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.
  • value - The value to set the session variable to.  Can be any valid PHP value, including arrays.

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->set('id', 123);
$session->save();