not quite variable variables
Posted: Mon Mar 29, 2004 6:01 pm
I want to pass the name of a variable in a function, then have that refer to an array variable and make some totally awesome happenings happen. A pseudo-example:
$how_many never gets a value.
Several valid examples for $type are already set before this function is set. So for instance, if I call get_loaded("widgets"), I want to count the array values in $widget, already set:
variable variables are not the answer I once dreamed they were, and concating doesn't seem to do the trick either.
Code: Select all
function get_loaded($type)
{
$how_many = count($type);
die($how_many);
}Several valid examples for $type are already set before this function is set. So for instance, if I call get_loaded("widgets"), I want to count the array values in $widget, already set:
Code: Select all
$widget["floaty"] = "magnificent floaty";
$widget["smackbox"] = "this sure is content.";
$widget["dracula"] = "hanging from the ceiling";