Hi, everyone! :)
I would like to know if an array, when given as function argument, is cloned (occupying more memory), or it is just referenced (but not modified as global variable).
I will explain:
$array = array(2, 3);
$var = $array; // this is reference, if I change $var, I will change $array
-------
And I am asking about this:
function checkArray($ar) {
return ($ar[1] > 0);
}
$array = array(1, 2, 3);
$var = checkArray($array);
In this case, will $array be recreated/cloned to checkArray()?
I just want to know, because I have a function that may *SOMETIMES* need to check two arrays, and I have always to give those arrays as argument, but I don't want to waste memory when those arrays are not needed...
Thanks in advance for your help!