note 7944 added to session_register
| From: | snowjunkie2 at yahoo dot com | Date: | Mon, 21 Aug 2000 16:24:24 +0000 |
| Subject: | note 7944 added to session_register | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-2897@lists.php.net to get a copy of this message | ||
Registering a variable creates a global instance of the variable, but it does not automatically pull
it into the local scope.
So to set a registered variable within a function:
<?
session_start();
function test( $val ) {
session_register( "somevar" );
// $somevar = $val; //-- This will NOT set the value of the registered somevar, instead it creates
a local, albeit unrelated, instance
$GLOBALS['somevar'] = $val; //This sets the registered $somevar
}
test( "A value" );
?>
http://www.php.net/manual/function.session-register.php