javascript数组与php数组的地址传递及值传递用法实例_PHP

WBOY
Release: 2016-05-31 13:17:10
Original
838 people have browsed it

本文实例讲述了javascript数组与php数组的地址传递及值传递用法。分享给大家供大家参考。具体如下:

javascript数组为地址传递/引用传递,而php数组为值传递

实例代码如下:

代码如下:

$arr = array(3,9,4);
function test($arr){
 $arr[0] = 30;
}
test($arr);
foreach($arr as $val){
 echo $val." ";
}
?>


php部分输出结果为:3 9 4。

javascript输出结果为:35

希望本文所述对大家的php程序设计有所帮助。

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