> Online tutorial : argument passed by reference
Showing posts with label argument passed by reference. Show all posts
Showing posts with label argument passed by reference. Show all posts

argument passed by reference

By default arguments are passed by value(so that it will changed inside function only not outside the function).So we are going the value then send value by reference,prepend by (&) to the argument name in the function definition.
Syntax
function fun_name(&$varname)
Example

<?php
function my(&$num)
{
$num='welcome';
}
$str="welcome";
my($str);
echo $str;

?>


Output