Re: Access array data in foreach?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Uh. (Embarrassed)

Thanks anyway!!

-W
""Casey Chu"" <heavyccasey@xxxxxxxxx> kirjoitti 
viestissä:1a221fe0701060900s4f360981v5b3ece8bd6604ec3@xxxxxxxxxxxxxxxxx
> $value holds the value of the current array element.
>
> On 1/6/07, William Stokes <kalles@xxxxxxxxxxxxx> wrote:
>> Hello,
>>
>> I Have an array $toplevel containing arrays:
>> Array (
>>
>>    [0] => Array (
>>            [0] => 1
>>            [1] => 1
>>            [2] => eka
>>            [3] => eka.php )
>>
>>    [1] => Array (
>>            [0] => 2
>>            [1] => 1
>>            [2] => toka
>>            [3] => toka.php )
>>
>>    [2] => Array (
>>              [0] => 3
>>              [1] => 1
>>              [2] => kolmaz
>>              [3] => kolmas.php )
>>
>>    [3] => Array (
>>              [0] => 4
>>              [1] => 1
>>              [2] => nepa
>>              [3] => nepa.php )
>>
>>  )
>>
>> How access the data in foreach? Now I do this and it prints Array[2] to
>> screenin every loop.
>>
>> foreach ($toplevel as $value){
>> print "myTest.addLabel('labelBullet', '$toplevel[2][2]', 
>> $TopLevelCounter+1,
>> 250, '#CC0000', '#0000aa', '$toplevel[3]', 'left');\n";
>> $TopLevelCounter ++;
>> }
>>
>> But
>> print $toplevel[2][2]
>>
>> outside foreach prints kolmaz like I suppose it should
>>
>> Thanks again
>> -Will
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux