Reply to Re: Equivalent of upvar

Your name:

Reply:


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

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация