$this and php
by alamster in May 20th, 2008
Little mistake on naming variable make me confuse for almost an hour.
$this
yes, $this is built-in variable that often use in OOP. By using $this, we refer to self referencing variable.
More in php.net manual
<?php
class A
{
function foo()
{
if (isset($this)) {
echo '$this is defined (';
echo get_class($this);
echo ")\n";
} else {
echo "\$this is not defined.\n";
}
}
}
class
B
{
function bar()
{
A::foo();
}
}
$a = new A();
$a->foo();
A::foo();
$b = new B();
$b->bar();
B::bar();
?>
Michael Jackson
Freelance Project:
- Nonpublic project #462481 by danielrosenfield
- need real sing up by rasselnijam
- Nonpublic project #462007 by alphius
- Property Website Search Criteria (PHP) by ajayuk
- need 5 - 500 words articles about ppc marketing by assaflevi
- Link Building in Online Forums by zctglassman83
- Flash Web Designer/knows Hostgator Cpanel & Templates by marvelousmarilyn
- Do-Follow Blog Commenting by zctglassman83
- Email accouts need urgent by rasselnijam
- zen cart hacker by quitbgn


No Comment
Random Post
Leave Your Comments Below