Reply to Re: ampersand before var in function

Your name:

Reply:


Posted by noone on 03/18/06 01:12

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.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация