Home >php教程 >php手册 >javascript数组与php数组的地址传递及值传递用法实例,javascript数组

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

WBOY
WBOYOriginal
2016-06-13 09:16:44808browse

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

本文实例讲述了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程序设计有所帮助。

Statement:
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