function declaration of e.g. asort()

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

Post Reply
geethalakshmi
Forum Commoner
Posts: 31
Joined: Thu Apr 24, 2008 10:38 pm

function declaration of e.g. asort()

Post by geethalakshmi »

What does & beside argument mean in function declaration of e.g. asort()?

Regards,
geetha
http://mycollege.in
http://www.zyxwvutsrqponmlkjihgfedcba.co.in
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: function declaration of e.g. asort()

Post by Benjamin »

It means your passing a variable by reference, so that any changes made to the copy will affect the original. This is not required with the asort function.
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Re: function declaration of e.g. asort()

Post by Ollie Saunders »

notice how in the example on the manual page it's...

Code: Select all

asort($fruits);
...and not...

Code: Select all

$fruits = asort($fruits);
There's a section in the language reference part of the manual on references for more information.
Post Reply