anujgarg Posted October 21, 2009 Share Posted October 21, 2009 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 More sharing options...
anujgarg Posted October 21, 2009 Author Share Posted October 21, 2009 I got a solution: $GLOBALS['thisprofile'] = 'MY-AM'; Link to comment https://forums.phpfreaks.com/topic/178436-3-d-array/#findComment-940966 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.