
How do you pass a variable by value?

Hi friends,
Just like in C++, put an ampersand in front of it, like $a = &$b
/*--------------Pass By value----------------*/
function add($a)
{
return ++$a;
}
add($a);
/*---------------Pass by reference------------*/
function add(&$a)
{
return $a++;
}
add($a)
Thanks...
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.