Php 函数从输入或引用中创建新的数组(数据)


Php function creates new array (data) from input or references to it?

我有一个一般的php问题。我有一个大小数组,假设大小为 3。我将其作为输入传递给包含文件中的函数。那么,它是复制数组(更多内存)还是实际上使函数引用它?

$arr = array('a', 'b', 'c');
include(functions.php);    //doSomething() resides here
$result = doSomething($arr);
$result = array('a', 'b', 'c');
include(functions.php);    //doSomething() resides here
doSomething($result);

并定义

function doSomething(&$result) {/* code */}

并且不使用更多内存。