Home > Backend Development > PHP Tutorial > Usage examples of address transfer and value transfer of javascript arrays and php arrays, javascript array_PHP tutorial

Usage examples of address transfer and value transfer of javascript arrays and php arrays, javascript array_PHP tutorial

WBOY
Release: 2016-07-13 10:09:14
Original
838 people have browsed it

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.

www.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...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template