RE: [PHP] Finding value in multi-dimensional array - Solved
| From: | Ford, Mike [LSS] | Date: | Wed, 14 Apr 2004 14:20:40 +0000 |
| Subject: | RE: [PHP] Finding value in multi-dimensional array - Solved | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-183318@lists.php.net to get a copy of this message | ||
On 10 April 2004 02:21, Verdon Vaillancourt wrote:
> Hi,
>
> Thanks much to Richard and Andy for the input :) This one
> did the job...
>
> if($_SESSION['OBJ_user']->modSettings['listings']['active'] ==
> '1') {
>
> I'm still not entirely sure I understand the syntax ;)
Well, by relating back to your print_r() and building up the syntax by stages, you can see that
$_SESSION['OBJ_user'] is...
> > > phpws_user Object
... an OBJECT (of class phpws_user), with a property of ($_SESSION['OBJ_user']->)...
> > > (
> > > [modSettings] => Array
... modSettings ($_SESSION['OBJ_user']->modSettings) which is an ARRAY
($_SESSION['OBJ_user']->modSettings[]), which has a subscript (or key) of...
> > > (
> > > [listings] => Array
... 'listings' ($_SESSION['OBJ_user']->modSettings['listings']),
which is in turn an ARRAY ($_SESSION['OBJ_user']->modSettings['listings'][]),
which has a subscript of...
> > > (
> > > [active] => 1
... 'active'
($_SESSION['OBJ_user']->modSettings['listings']['active']). TaDa!
HTH.
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: m.ford@leedsmet.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211