On Thu, 2008-11-27 at 22:22 -0600, Micah Gersten wrote:
>
> This is actually a much smaller data structure.
> 
> $colleges = array
> (
>       'Blah Blah University' =>
>         array
>         (
>             'physics' => array
>                 (
>                     'sss',
>                     'sffgg',
>                 ),
>             'english' => array
>                 (
>                     'sss',
>                     'sffgg',
>                 )
>       ),
>       'Glah Gleh University' =>
>         array
>         (
>             'physics' => array
>                 (
>                     'sss',
>                     'sffgg',
>                 ),
>             'english' => array
>                 (
>                     'sss',
>                     'sffgg',
>                 ),
>         )
>  );
> 
> 
> foreach( $colleges as $collegeName => $depts )
> {
>      foreach( $depts as $deptName => $classes)
>     {
>         foreach( $classes as $className )
>         {
>             echo "$collegeName, $deptName, $className\n";
>         }
>     }
> }

Yes, I thought of that one too, but it's less flexible. What if you need
to add other fields to the college, or department. Then you'd need to
redo the whole structure to something more similar to what I did. Since
bruce was having issues, I gave him a flexible format that could handle
other fields if they arose.

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

Reply via email to