I generally don't need to use php reference symbols when writing code. First of all, I don't know much about its usage. The C language is used to obtain the address, but PHP may be somewhat different, it is said to be a copy of the variable, that is, re-copy the same variable, such
$ A = & $ B;
Then, variables a and B are completely equal, which is equivalent to $ a = $ B. Is it necessary to write $ a = & $ B? This may also occupy more memory space.
Some people like to write it like this.
Function & f ($ arg1 ,..){
// Code body
}
In my opinion, writing in this way has no practical effect. Generally, the reference operators are written in the parameters of the function:
Function f (& $ x, & $ y ){
// The operations on $ x and $ y are assigned to $ x and $ y. If both $ x and $ y are returned outside the function;
// No return statement is required.
}
If function f is called, the calculated values of $ x and $ y can be obtained outside the function.
$ Total = array ();
$ Total_data = '';
F (& $ total, & $ total_data );
Echo $ total_data; // output the value of total_data after f function compute.
Var_dump ($ total); // The total value after f function calculation is output here.
These are my personal opinions. I hope you can correct them.