By default, the function arguments are passed by value. If you want to allow a function to modify the value of its arguments, you can pass them by calling.
If you want a function parameter to be passed by reference, you can pre-sign the parameter name in the definition of the function (&):
function foo (& $bar) {
$bar. = and something extra.;
}
$str = This is a string,;
Foo ($STR);
Echo $str; The output is a string, and something extra.
If you want to pass arguments to a function that is not defined in this way by calling, you can add a symbol (&) to the name of the parameter in the function call.
function foo ($bar) {
$bar. = and something extra.;
}
$str = This is a string,;
Foo ($STR);
Echo $str; Output This is a string,
Foo (& $str);
Echo $str; The output is a string, and something extra.
http://www.bkjia.com/PHPjc/531960.html www.bkjia.com true http://www.bkjia.com/PHPjc/531960.html techarticle by default, function arguments are passed by value. If you want to allow a function to modify the value of its arguments, you can pass them by calling. If you want a function parameter will ...