|
Posted by frizzle on 03/18/06 01:26
noone wrote:
> frizzle wrote:
> > Hi there,
> >
> > Recently i noticed a few times an ampersand in front of a variable in a
> > function.
> > Like so:
> >
> > function foo( &$bar )
> > {
> > // do something
> > };
> >
> > What is it for? I can't figure it out ...
> >
> > Frizzle.
> >
>
>
> from:
> http://www.softwareprojects.org/php-functions-12.htm
>
> Another way to access the data outside the function, without using an
> argument is by using a reference to a variable as an argument. You can
> do this by placing an ampersand "&" in front of the argument, when you
> define the function. This way, the function will directly access the
> variable thru the reference, and the variable can be assigned and read
> at the same time.
Hmm, could you maybe give me a small simple example ?
Thanks.
Frizzle.
[Back to original message]
|