OOP::problem?
| From: | Matthias Nothhaft | Date: | Tue, 01 Apr 2003 08:47:20 +0000 |
| Subject: | OOP::problem? | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-4565@lists.php.net to get a copy of this message | ||
Hi all,
this is my first mail to this list,
but I don't know if this is the right one
for my problem, because it is not really depending
on pear, but I hope there are some php devs, who
can help me?
Ok, I have a little idea to use it in PEAR...
I promise I'll tell it in my next posting ;-)
Take a look at my example:
<?php
class a
{
function test($s)
{
$this->myvar = $s;
}
}
class b
{
var $myvar;
function b($s)
{
a::test($s);
echo $this->myvar;
}
}
$b =& new b("hello world!");
?>
The output is... "hello world!"
Now my "problem": Is this a bug or a feature,
that I can access to class variables of any object
by using $this->anyvar in a class::function() ?
Thanks,
Matthias