In php, the parameters in the function are passed by value. For example:
<?php $a = 12; function f($a) { $a += 10; } f($a); echo $a; ?>
If you want to change it to pass by reference, then you only need to change the function body and use Reference symbol &:
function f(<span style="color:#FF0000;">&</span>$a) { $a += 10; }
function f($a) { global $a; $a += 10; }
Copyright statement: This article is written by the blogger Original articles cannot be reproduced without the permission of the blogger.
The above introduces the use of references and global in PHP, including aspects of the content. I hope it will be helpful to friends who are interested in PHP tutorials.