Re: Passing array names into a function
| From: | Geoff Caplan | Date: | Wed, 05 Sep 2001 22:05:00 +0000 |
| Subject: | Re: Passing array names into a function | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-66115@lists.php.net to get a copy of this message | ||
Brian
Thanks for the response, but unless I am misunderstanding, I don't think
this is what I am after.
Just to restate, I want to set up a module as a static data cache. The main
function $my_cache will have a static array $data. There will be a set of
helper functions to set values into $data, get values from $data, lock
values, mark them as dirty etc.
Calling functions will be able to store and manage values in the cache for
other functions to access.
I need to be able to pass an array addresse of n dimensions into $my_cache
together with a value, and an action such as "set", "get", "unset"
etc:
$my_cache( "set", "['key1']['key2']" , "someval" )
;
Then somehow, inside $my_cache, I need to assign the value to $data as
follows:
$data"['key1']['key2'] = "someval" ;
As I say, I have been mucking about with eval( ) and variable variables with
no success. Guess I am having a bad brain day. Any help much appreciated -
its getting late here and I am running out inspiration....
Thanks again
Geoff Caplan