You are here: Re: Returning a 2 dimensional array « PHP Programming Language « IT news, forums, messages
Re: Returning a 2 dimensional array

Posted by Richard Brooks on 11/04/05 02:31

Parrot wrote:
> On 3 Nov 2005 14:28:49 -0800, "Chung Leong">
> <chernyshevsky@hotmail.com> wrote:
>
>
>>Don't see anything wrong with the code. I suspect the problem lies in
>>the way you access the array. Do a print_r() on the return value and
>>see if you're getting what you're supposed to.
>
>
> I set up a simple test script to try and figure out how to work the
> arrays:
>
> <?
> function test()
> {
> $array[0][0] = "Hello";
> $array[0][1] = "World";
> $array[1][0] = "How Are";
> $array[1][1] = "You?";
>
> return array($array);
> }
>
> $array = test();
> echo $array[0][0];
> ?>
>
> When I run it it just prints out the word "Array".
>

Doing a Google search I came across this URL but the interesting thing
was the last line.

"Multi-dimensional arrays

PHP does not explicitly support multi-dimensional arrays. However PHP
allows arrays of any type of object, including arrays so two dimensional
arrays can be implemented as arrays of arrays. "

<http://www.scit.wlv.ac.uk/~jphb/sst/php/lang/phparrays.html>


Richard.

 

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

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