Jump to content

3-D Array


anujgarg

Recommended Posts

Hi Everyone,

 

I am facing a problem with 3-Dimensional Array. The problem is as follows:

I have defined an array in a file abc.php as

 

$GLOBALS['known_profiles'] = array(

'ADMIN' => array(

'show' => array('options'), // In which sections to allow this profile to be shown as an option '*' for all

'name' => 'ADMIN', // This MUST match the key

),

 

 

'MY-AM' => array(

'ip' => 'xxx.xxx.xx.xxx',

'show' => array('*'),

'name' => 'MY-AM',

'lang' => 'en',

),

 

      'MY-AD' => array(

'ip' => 'xxx.xxx.xx.xxx',

'show' => array('*'),

'name' => 'MY-AD',

'lang' => 'fr',

        ),

);

 

Now I am printing this array in another file:

 

print_r($GLOBALS['known_profiles']['MY-AM']['name']);

 

which gives me correct output.

 

But I need to use another array variable into it as:

print_r($GLOBALS['known_profiles'][$GLOBALS['thispofile']]['name']);

 

I want to define second index as a variable and use the values ('MY-AM' or 'MY-AD') into it.

How can I do it?

 

Please suggest...

 

TIA

 

Anuj

Link to comment
https://forums.phpfreaks.com/topic/178436-3-d-array/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.