Methods for PHP reference operations and local static variables for external operation functions
A static variable inside an external manipulation function or member method by means of a reference
Here is a simple example of three questions about quoting:
1. A type conversion within a function after a parameter reference is also an address operation
2. Once the parameter is referenced and passed to another function, the reference must be added again to maintain the address operation
3. Function return value reference must add Reference operator at function declaration and call
This example uses the action of the object method, and the same applies to the function
Test2 ($a); $i ++;var_dump ($a); Var_dump ($i); return $i;} protected function Test2 (& $a) {$a [' name '] = ' snail ';}} $obj = new A (); $a = "; $c = & $obj->test1 ($a); $c ++;var_dump ($a); $obj->test1 ($a); Var_dump ($a);
Results of the output
http://www.bkjia.com/PHPjc/859805.html www.bkjia.com true http://www.bkjia.com/PHPjc/859805.html techarticle The PHP reference operation and the method of the local static variable of the external operation function are referred to as a simple example under the static variables inside the external operation function or member method, stating ...