[nycphp-talk] follow-on variable variables question
James Wetterau
james at surgam.net
Fri Feb 13 17:40:39 EST 2004
Adam Fields says:
...
> $elementname = "element".$somelabel;
> global $$elementname;
> for ($count = 1; $count <= $vp[varcounter]; $varcount++) {
> $$elementname->add_subobject($vp[type], $vp[vname][$count], $vprop);
> };
>
> This is a small chunk of code that lets you set the name for an object
> according to a rule, then execute a method of that object. The array
> values passed to the method are also dynamically named.
Ok, but you can do all the above with array keys, so why not use
those?
...
> It's actually a classic TCL technique, which is where I learned it.
...
It's also fairly common in shell scripting, but there you haven't much
of an alternative for namespaces.
More information about the talk
mailing list
Automatic Email Organization without missing anything!