note 100286 deleted from function.session-register by danbrown

From: Date: Wed, 06 Oct 2010 14:45:13 +0000
Subject: note 100286 deleted from function.session-register by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-173013@lists.php.net to get a copy of this message
Note Submitter: John ---- <?php session_start(); // old way /* if(!session_is_registered("sess")) { $sess = array(); session_register("sess"); } */ // mimic old behavior if(!isset($_SESSION['sess'])) { $_SESSION['sess'] = array(); $sess =& $_SESSION['sess']; } $_SESSION['sess']['fname'] = "john"; function test() { global $sess; echo "first name:".$sess['fname']; } test(); ?> should output: "first name:john"

« previous php.notes (#173013) next »