Hi,

I am making practice with arrays, I want to buil a two dimensions array.

I am trying something like:

$basket[0][0]="Apple";
$basket[0][1]="yellow";

but it seems not correct...

what is wrong ?

And which is the right sintax to get out data from them ?

echo($basket[0][0]);

seems not good too...

Sorry for the stupid question but I ambecoming mad ;-)

Fabio

    $basket = array(
    array("Apple", "yellow",...),
    array(...),...
    );

    or

    $basket = array();
    $basket[] = array("Apple", "yellow",...);
    $basket[] = array();
    ...

    Bidimensional array is just an array of arrays.

      #@@!!!#...

      I was right with my syntax !

      After wasting an hour I have discovered that the problem was only related to the way I was trying to output the content: I need to use {} to define the array in a echo command!!

      ...hope to have solved my problems now..

      Thank you very much!

        If u need dynamic arrays,u might :

        $array_1[0]="somthng1";
        $array_1[1]="somthng2";
        // or in a loop

        then:

        array_push($main_array[$i],$array_1);

        $main_array must be declared before calling
        array_push();

          Write a Reply...