Re: Finding value in multi-dimensional array - Solved
| From: | Verdon Vaillancourt | Date: | Sat, 10 Apr 2004 01:20:51 +0000 |
| Subject: | Re: Finding value in multi-dimensional array - Solved | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-183046@lists.php.net to get a copy of this message | ||
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 ;)
verdon
> From: Richard Harb <rharb@earthling.net>
> Date: Fri, 9 Apr 2004 22:49:44 +0200
> Let's see:
> if($_SESSION['OBJ_user']->modSettings['listings']['active'] ==
> '1') {
>
> That should be it ...
>
> Sidenote: use single quotes whenever the string needn't be evaluated
> (i.e. is a variable itself) you save a couple cycles every time.
>
>> phpws_user Object
>> (
>> [user_id] => 5
>> [username] => agent
>> [password] => 77abcd5cb2ef4a366c2749ea9931c79e
>> [email] => agent@email.com
>>
>> [modSettings] => Array
>> (
>> [listings] => Array
>> (
>> [active] => 1
>> [first_name] => Agent
>> [last_name] => Guy
>> )
>>
>> )
>>
>> [error] => Array
>> (
>> )
>>
>> [temp_var] =>
>> [last_on] => 1081527610
>> [js_on] => 1
>> [user_settings] =>
>> )
>
>
On 4/9/04 4:06 PM, "Richard Harb" <rharb@earthling.net> wrote:
> do a print_r() for the structure. --> print_r($_SESSION["OBJ_user"]);
> and look at the page source.
>
> at each level ...
> if is says array refer to it with ['property']
> if obj (stdClass or otherwise) use -> that arrow thingy
>
>
> Friday, April 9, 2004, 9:43:36 PM, you wrote:
>
>> Hi, being somewhat of a noob, I hope I'm using the right language to phrase
>> this question...
>
>> In a project I am working with, I have a multi-dimensional array in session
>> when a user logs in. Visually, it looks something like...