Passing an array vs Array_merge
Posted: Wed Mar 15, 2006 6:54 pm
Does anyone have comments on what technique would be faster, use less memory, etc...
Code: Select all
/************ START - Technique 1 ***********/
function mainProcess(){
while(something){
$totalCollection = $this->collectMore($totalCollection);
}
}
function collectMore($passedArray){
while(something){
$passedArray[] = $newObject;
}
return $passedArray;
}
/************ START - Technique 2 ***********/
function mainProcess(){
while(something){
$totalCollection = array_merge($totalCollection, $this->collectMore());
}
}
function collectMore(){
while(something){
$passedArray[] = $newObject;
}
return $passedArray;
}