Home  >  Article  >  Backend Development  >  javascript数组与php数组的地址传递及值传递用法实例_php技巧

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

WBOY
WBOYOriginal
2016-05-16 20:25:171152browse

本文实例讲述了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