You are here: Re: Function returning 2 arrays - which way to do so? « PHP Programming Language « IT news, forums, messages
Re: Function returning 2 arrays - which way to do so?

Posted by Logos on 01/07/08 14:04

On Jan 7, 2:34 am, Michael Fesser <neti...@gmx.de> wrote:
> .oO(jodleren)
>
> >I have a function, a part of my code which I can use as a function. It
> >will return 2 arrays, and I am wondering what way to do so. Both
> >arrays hold strings, there are no special keys.
>
> >1) setting the arrays as globals
>
> No.
>
> >2) returnin an array of arrays
>
> Possible.
>
> >3) returning a large array with a known marker to indicate when the
> >2nd part starts.
>
> No.
>
> >Any other ideas?
>
> 4) Arguments passed by reference:
>
> function foo(&$arg1, &$arg2) {
> $arg1 = array(1, 2, 3);
> $arg2 = array(4, 5, 6);
>
> }
>
> Micha

I'll second this one. Passing in both arrays by reference is clean &
tidy, and a commonly accepted way for a function to 'return' more than
one value.

 

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

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