note 7944 deleted from function.session-register by sniper

From: Date: Thu, 31 Oct 2002 00:44:36 +0000
Subject: note 7944 deleted from function.session-register by sniper
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-38776@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" ); ?>

« previous php.notes (#38776) next »