params use references, pointers in php or script function

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
php12342005
Forum Commoner
Posts: 79
Joined: Mon Mar 21, 2005 3:35 am

params use references, pointers in php or script function

Post by php12342005 »

in C++, we can pass references or pointers as function's parameters.
i.e.

void MyCpp(int&i0,int&i1,int&i2);//references
or
void MyCpp(int*pi0,int*pi1,int*pi2);//pointers

when the function returns, all parameters can be modified by the function's body.

-------------------------
my question is:
can a php or java-script function use parameters similar to references or pointers in C++?

if yes, how?

thanks
User avatar
nielsene
DevNet Resident
Posts: 1834
Joined: Fri Aug 16, 2002 8:57 am
Location: Watertown, MA

Post by nielsene »

You can pass by reference in php, simply prepend the '&' to the variable name in the function signature.
Post Reply