String: Arrays of arrays.

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

 



Hi,

I have an array of array of strings :-

$g1 = array("453", "592");
$g2 = array("e14", "e15", "e13");
$groups = array($g1, $g2);

I traverse and print out the value using :- 

      for ($i = 0; $i < sizeof($groups); $i++) {
         for ($j = 0; $j < sizeof($groups[$i]); $j++) {
            print "<!--=$groups[$i][$j]=-->\n"; /* line?? */
         }
      }

But the end result is :- 

<!--=Array[0]=-->
<!--=Array[1]=-->
<!--=Array[0]=-->

My expected result is :- 

<!--=453=-->
<!--=592=-->
<!--=e14=-->

But when I change the line from:- 

print "<!--=$groups[$i][$j]=-->\n"; /* line?? */

to include :- 

$cid = $groups[$i][$j];
print "<!--=$cid=-->\n"; /* line?? */

I seem to get the results I want. 

Why is this? Is there a syntax error? 

Thanx

--
Ken

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