|  | Posted by petersprc on 02/07/07 14:53 
Hi,
 Please try: return recurseArray($arrayValue);
 
 Should do the trick.
 
 On Feb 7, 9:49 am, "Aggelos" <djje...@gmail.com> wrote:
 > Hello,
 > I am using php4
 > And I have a class product
 > I create an array of productObjects that has 2 dimensions.
 > Generraly I am sorting my objects inside arrays and I need to some how
 > recurse those arrays to get to the objects.
 >
 > To do that I am using the following method recurseArray()
 >
 > function recurseArray($array) {
 >         if(is_array($array)) {
 >                 foreach($array as $arrayValue) {
 >                         recurseArray($arrayValue);
 >                 }
 >         }
 >         elseif(is_object($array)) {
 >                 $object = $array;
 >                 return $object;
 >         }
 >
 > }
 >
 > the problem with that is that when i try to do
 > $_product = recurseArray($productArray)
 > print_r($_product);
 >
 > it won't pring anything. But if i do the pring inside the method like
 > that
 > ...
 > elseif(is_object($array)) {
 >                 $object = $array;
 >                 print_r($object)
 >                 return $object;
 >         }
 > ...
 > it will print my object.
 >
 > Do you know why is this happening ?
 > It makes me crazy !!!
 > Thanks, Angelos.
  Navigation: [Reply to this message] |