重要的是我传递给函数的大小


Is important the size of what I pass to the function?

我想知道,我应该尝试向函数传递一个小值吗?还是没关系?

例如:

$sth->execute();
function myfunc ($sth){ // do something}

$sth->execute();
$end = $sth->fetch()
function myfunc ($end){ // do something}

哪一个更好?

这没关系。函数调用的性能并不取决于参数的大小。值是在内部处理的,因此它们基本上总是通过某种引用传递。PHP在将值传递给函数时并不是在复制它(是的,即使它在userland中可能以这种方式)。