STOP: [PHP] $this as function parameter
| From: | Moritz Petersen | Date: | Sun, 07 Jan 2001 12:19:22 +0000 |
| Subject: | STOP: [PHP] $this as function parameter | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-33086@lists.php.net to get a copy of this message | ||
I'm too stupid.
Sorry, please ignore this message. It works now...
(Welcome on your "ignore-list"... :-( )
CU
Mo.
-----Original Message-----
From: Moritz Petersen [mailto:moritz.petersen@disc-us.de]
Sent: Sunday, January 07, 2001 1:16 PM
To: Php-General@Lists. Php. Net
Subject: [PHP] $this as function parameter
Hi Guys,
I'm trying the following:
<code>
class EnvironmentContainer
{
var $environment;
function set_environment($environment)
{
$this->environment = $environment;
}
}
class GlobalEnvironment
{
var var1 = "hello world!";
var content;
function init()
{
$this->content = new Content();
$this->content->set_environment($this);
}
function echo_all()
{
$this->content->echo_content();
}
}
class Content extends EnvironmentContainer
{
function echo_content()
{
echo $this->environment->var1;
}
}
$global_env = new GlobalEnvironment();
$global_env->init();
$global_env->echo_all();
</code>
Which produces: NOTHING! Not even an error-message! Why?
It should produce: "hello world!".
Has anyone an answer?
Thanks,
Mo.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net