Usage examples of address transfer and value transfer of javascript arrays and php arrays, javascript arrays
The example in this article describes the use of address passing and value passing of javascript arrays and php arrays. Share it with everyone for your reference. The details are as follows:
Javascript arrays are passed by address/reference, while php arrays are passed by value
The example code is as follows:
Copy code The code is as follows:
$arr = array(3,9,4);
function test($arr){
$arr[0] = 30;
}
test($arr);
foreach($arr as $val){
echo $val." ";
}
?>
The output result of the php part is: 3 9 4.
javascript output result is: 35
I hope this article will be helpful to everyone’s PHP programming design.
http://www.bkjia.com/PHPjc/946760.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/946760.htmlTechArticleUsage examples of address transfer and value transfer of javascript arrays and php arrays, javascript arrays This article explains the use of javascript arrays and php Array address transfer and value transfer usage. Share with everyone...