当前位置: 动力学知识库 > 问答 > 编程问答 >

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

问题描述:

This question already has an answer here:

  • Will copy-on-write prevent data duplication on arrays?

    2 answers

网友答案:
$result = array('a', 'b', 'c');
include(functions.php);    //doSomething() resides here
doSomething($result);

and define

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

And not use more memory..

分享给朋友:
您可能感兴趣的文章:
随机阅读: