Re: Re: Get recursive array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Bruno B B Magalhães wrote:
Hi Jochem,

well, thanks for the code... it's working perfect, but it seams a little bit slow as it's using while... doesn't?

slow as compared to what? - its a very basic loop.
maybe a foreach loop would run quicker but unless you we're calling
this method 10,000s of times per request I doubt you see any difference.

I don't actually know which would be theoretically faster anyway.


Now, abusing of you, how can I unset a variable the same recursive way? :D Maybe like this?

not to seem rude - but have you bothered to try it out?
looks like it should work btw.



/ ***********************************************************************
    * @function_name get_var
    * @function_type Method
    * @function_input None
    * @function_description None
***********************************************************************/
    function get_var()
{ $arguments = func_get_args(); if(empty($arguments))
        {
            return null;
        }
$reference =& $this->vars; while($argument = array_shift($arguments))
        {
            if(!isset($reference[$argument]))
            {
                return null;
            }
            else
            {
                $reference =& $reference[$argument];
            }
        }

        unset($reference);
    }


And I didn't double posted, I had to subscribe... and I didn't know if my message had been sent or not.

righto - no big deal either way :-) it might get annoying if double posted
all day every day though ;-)


Thanks,
Bruno B B Magalhaes


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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux