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

Posted by Parrot on 11/04/05 01:19

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".

When I replace the "echo $array[0][0];" line with "print_r ($array);"
it gives me:

Array ( [0] => Array ( [0] => Array ( [0] => Hello [1] => World ) [1]
=> Array ( [0] => How Are [1] => You? ) ) )

Is it returning a 3 dimensional array or something??

 

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

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