|
Posted by Erwin Moller on 09/15/05 17:09
am_ggh@hotmail.com wrote:
> Is there a PHP equivalent of TCL's "upvar" ?
>
> I will appreciate any insights.
> Andy
Hi Andy,
upvar?
[if memory serves me well, TCL long time ago]
Isn't that a function to change variables in the environment of the CALLING
function?
------------------
$a = "hello";
something();
echo $a;
function something() {
// phantasycode
upvar ($a, "Joe");
}
------------------
That outputs Joe, right?
upvar IN function something() accesses variable $a in the
context/environment of the place where something() is called.
(That always confused the hell out of me.)
If that is what upvar does, I do not think there exists a PHP equivalent.
(That is: I never saw it)
But if you use objects, you can easily achieve the same functionality, I
expect.
Maybe using $_GLOBAL can also help for desired functionality.
Just my 2 cents...
(Me no expert on upvar. )
Regards,
Erwin Moller
Navigation:
[Reply to this message]
|