wat does the operator :: use for?
Posted: Wed Sep 09, 2009 11:06 am
hey,fellows ,i got some difficults when i was having the class knowledge of php.
codes belows:
<?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();
?>
it's an example on php.net....i am wondering wat does the opereator "::" means by ? would anyone give me a hand?
codes belows:
<?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();
?>
it's an example on php.net....i am wondering wat does the opereator "::" means by ? would anyone give me a hand?