By default, function parameters are passed through values. If you want to allow a function to modify its parameter values, you can pass them through calls.
If you want a function parameter to be passed through the reference, you can add the symbol (&) before the parameter name in the pre-Function Definition (&):
Function foo (& $ bar ){
$ Bar. = and something extra .;
}
$ Str = This is a string ,;
Foo ($ str );
Echo $ str; // output This is a string, and something extra.
If you want to pass parameters to a function that is not defined in this way by calling, you can add the symbol (&) before the parameter name 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; // output This is a string, and something extra.