You are here: Re: Recurse an array with an object/s « PHP Programming Language « IT news, forums, messages
Re: Recurse an array with an object/s

Posted by Rik on 02/07/07 16:43

Aggelos <djjelly@gmail.com> wrote:
> This is my suggested sollution:
> It succesfully returns the object ... ofcourse you have to initialise
> the tempArray but I wasn't very sure about it ...
>
> function recurseArray($array) {
> if(is_array($array)) {
> foreach($array as $arrayValue) {
> $tempArray =3D recurseArray($arrayValue);
> }
> }
> elseif(is_object($array)) {
> return $array;
> }
> return $tempArray;
> }


This will only return the _last_ object found, as you continue to =

overwrite $tempArray for every array-element.

-- =

Rik Wasmus

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация