note 105291 deleted from language.references.pass by danbrown

From: Date: Mon, 08 Aug 2011 14:46:37 +0000
Subject: note 105291 deleted from language.references.pass by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-182326@lists.php.net to get a copy of this message
Note Submitter: thelordofcheese ---- >>northhero at gmail dot com You dolt. Of COURSE the global $string won't be changed. It's called SCOPE! The globla variable $string wasn't passed by reference, but when the instance of call_user_funct() executes change() the temporary local variable $string belonging to that instance of call_user_funct() is passed to change() by reference as defined by the parameter definition of change(). Of COURSE you'd have to pass $string by reference to call_user_funct() for the reference to the global instance of $string to be referenced by the instance of change() called by that instance of call_user_funct(). This is the case for ANY function that doesn't define the parameter as passed by reference in the function definition. And it scales through all function calls inside every function called by the entire chain of calling functions.

« previous php.notes (#182326) next »