* @copyright 2004 http://www.php-tools.net
* @license LGPL
**/
// load error handler
include_once './_error.php';
// include factory/loader
include_once '../patSession.php';
// create a single instance
$sess1 =& patSession::singleton( 'ham' );
// ...even if the creator function was called twice
$sess2 =& patSession::singleton( 'ham' );
if( $sess1 === $sess2 )
{
echo '
Session 1 and 2 are references to a single instance.
';
}
// ...or with different parameter(s)
$sess3 =& patSession::singleton( 'not_ham' );
if( $sess1 === $sess3 )
{
echo '
Session 1 and 3 are the same.
';
}
$sess4 =& patSession::singleton( 'ham_is_not_spam', 'Native', array( 'expire' => '10' ) );
if( $sess1 === $sess4 )
{
echo '
Session 1 and 4 are the same, too.
';
}
?>