[nycphp-talk] more on &$var in function
Chris Snyder
csnyder at chxo.com
Fri Sep 5 11:16:26 EDT 2003
Chris Shiflett wrote:
>--- Michael Southwell <southwell at dneba.com> wrote:
>
>
>>why wouldn't you *always* define the parameter with & instead of
>>using a global statement?
>>
>>
>
>Speaking personally, it depends on whether I think the parameter is closely
>related to the function and how much data is already required to be passed in.
>
>
I agree-- if you have a function that updates a number of global objects
or variables, you don't want to force yourself to list them all as
arguments every time you call the function.
As a further note, I always use global statements in order to make
objects available to the local scope, but for looking at or updating
regular variables I tend to use the $GLOBALS array so that the local
namespace doesn't get to crowded.
csnyder
More information about the talk
mailing list