hey robert..

ok.. so if i changed the array to have a dept1, and a dept2

$a=array("college"=> "foo",
         "dept1"=>array("dept"=> "physics",
  "class"=>array("class1"=>"sss","class2"=>"sffgg")
        ),
        "dept2"=>array("dept"=> "english",
"class"=>array("class1"=>"sss","class2"=>"sffgg")
)
                        );
how would i iterate through this..??

thanks


-----Original Message-----
From: Robert Cummings [mailto:[EMAIL PROTECTED]
Sent: Thursday, November 27, 2008 6:18 PM
To: bruce
Cc: 'PHP General list'
Subject: Re: [PHP] array/iteration issue!!


On Thu, 2008-11-27 at 17:31 -0800, bruce wrote:
> hi.
>
> i have the following test multidiminsional array. i'm trying to figure out
> how to iterate through the array, to produce something like
>
> foo, physics, sss
> foo, physics, sffgg
> foo, english, sss
> foo, english, sffgg
>
> can't quite seem to get it right!!
>
> thoughts/comments... etc...
>
> thanks
>
> --------------------
> $a=array("college"=> "foo",
>        "dept"=>array("dept"=> "physics",
>   "class"=>array("class1"=>"sss","class2"=>"sffgg")
>       ),
>       "dept"=>array("dept"=> "english",
> "class"=>array("class1"=>"sss","class2"=>"sffgg")
> )
>                       );

You can't. You're array is valid but the second 'dept' key overwrites
the first. Thus the physics dept is lost.

Check it for yourself... print_r( $a )

Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP


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

Reply via email to