Get recursive array

From: Date: Mon, 06 Feb 2006 15:32:09 +0000
Subject: Get recursive array
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-229952@lists.php.net to get a copy of this message
Hi guys.. well I have a little "problem", I succeeded on retrieving a value by it's key, but I want a clean and faster method... Let me explain: I have the following function which I use to set variables in my framework like (configs, requests, etc)... /*********************************************************************** * @function_name set_vars * @function_type Method * @function_input None * @function_description None ***********************************************************************/ function set_var($key = '', $value = null) { if(is_array($key)) { if(count($key)) { foreach($key as $key_key => $key_value) { $this->vars[$key_key] = $key_value; } } } elseif(is_array($value)) { if(count($value)) { foreach($value as $value_key => $value_value) { $this->vars[$key][$value_key] = $value_value; } } } else { $this->vars[$key] = $value; } } For example I have: $this->vars['config']['database_type'] = 'mysql'; or... $this->vars['http']['get'] = 'b'; But now I want a function that gets those values and subvalues, but there is one small catch, I need to dynamically get parsed arguments and check if key exists and returns it... I tried func_num_args, and func_get_args, without success. Any ideas? Regards, Bruno B B Magalhaes

« previous php.general (#229952) next »