I am trying to save the data in an object that is located in a function that calls itself a variable number of times. I cant seem to capture all the data in the object, When the function is called a second time, the data in the object is erased(i think). I also need to return the object back to the main script. The object is "$myarray". Any advice?
********************
function doThis($this_part,$x,$whichLayer,$constantNumber,$myarray){
$myarray[$constantNumber]->subtype = findIt($this_part);
$myarray[$constantNumber]->layer = $whichLayer;
$whichLayer=$whichLayer+1;
$constantNumber=$constantNumber+1;
for ($x = 0; $x < count($this_part->parts); $x++) {
doThis($this_part->parts[$x],$x,$whichLayer,$constantNumber,$myarray);
}
}
for ($x = 0; $x < count($structure->parts); $x++) {
$whichLayer=1;
$constantNumber=0;
doThis($structure->parts[$x],$x,$whichLayer,$constantNumber,$myarray);
}
********************
thanks in advance
********************
function doThis($this_part,$x,$whichLayer,$constantNumber,$myarray){
$myarray[$constantNumber]->subtype = findIt($this_part);
$myarray[$constantNumber]->layer = $whichLayer;
$whichLayer=$whichLayer+1;
$constantNumber=$constantNumber+1;
for ($x = 0; $x < count($this_part->parts); $x++) {
doThis($this_part->parts[$x],$x,$whichLayer,$constantNumber,$myarray);
}
}
for ($x = 0; $x < count($structure->parts); $x++) {
$whichLayer=1;
$constantNumber=0;
doThis($structure->parts[$x],$x,$whichLayer,$constantNumber,$myarray);
}
********************
thanks in advance