Posted by Aggelos on 02/07/07 15:31
> function objects_from_array($var){
> $return = array();
> if(is_object($var)){
> $return[] = $var;
> }
> if(is_array($var)){
> $return = array_merge($return,objects_from_array($var));
> }
> return $return;}
>
That function will also enter an endless loop like petesprc
We need to loop inside the array to get the next dimension... don't
we ? so when you do arraymerge the $var should be the second dimension
of the array in the first call of the function.
Isn't that right ?
So I suppose I need to have a foreach loop
my array is like that
$productArray[$productTypeId][$productId][$published] = new
objectProduct();
so for that i would do 3 nested foreach loops ...
But I want to do that using a function to get to the objectProduct.
Navigation:
[Reply to this message]
|