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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to