Making arguments be passed by reference:

Making arguments be passed by reference:

Making arguments be passed by reference:
================================

By default,if the function arguments are passed by value .In which value is changed within that scope not outside the scope. To change value out of the function we have to pass by reference

If an argument passed to function as a reference. We have to prepend the (&) symbol to argument name

in the function definition:

function pass_refer(&$value)
{
$value = 10;
}

$value = ‘20′;
pass_refer($value);
echo $value;

output
=======
10

Leave a Reply

You must be logged in to post a comment.


All material @ copyrighted by chrisranjana.com. If you want to link to this article you are welcome to do so. Unauthorized publication is strictly prohibited. This developer tutorial website contains articles by Php programmers , Software developers, Mysql programmers and asp c# programmers. This website also contains ajax tutorials and advanced mysql sql stored procedures and functions tutorials and sample codes.