subhailc
11-21-2005, 09:20 AM
in js you can say
var a={prop1:value1,prop2:value2};
for(var i in a)this[i]=a[i];
alert(this.prop2)//to get back "value2";
//or
var a=document.getElementsByTagName('*');
for(var i=0;i<a.length;i++)this[a[i].id]=a[i];
//to scope ids as local object refs
how's that functionality work in php? i noticed i don't see 'this' often if at all - effectively just would like to scope the whole of REQUEST to the executing script. triedforeach($_REQUEST as $a)this[$a]=$a;
//and
foreach($_REQUEST as $a=>$b) $a=$b;but probably obviously, no good.
var a={prop1:value1,prop2:value2};
for(var i in a)this[i]=a[i];
alert(this.prop2)//to get back "value2";
//or
var a=document.getElementsByTagName('*');
for(var i=0;i<a.length;i++)this[a[i].id]=a[i];
//to scope ids as local object refs
how's that functionality work in php? i noticed i don't see 'this' often if at all - effectively just would like to scope the whole of REQUEST to the executing script. triedforeach($_REQUEST as $a)this[$a]=$a;
//and
foreach($_REQUEST as $a=>$b) $a=$b;but probably obviously, no good.