git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@169657 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Marcus Boerger 2004-09-30 18:22:30 +00:00
parent 375cd522c9
commit 78cf139559

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.3 $ -->
<!-- $Revision: 1.4 $ -->
<sect1 id="language.oop5.static">
<title>Static Keyword</title>
@ -23,6 +23,20 @@
the object created, the pseudo variable <varname>$this</varname> is
not available inside the method declared as static.
</para>
<para>
In fact <literal>static</literal> method calls are resolved at compile
time. When using an explicit class name the method is already identified
completley and no inheritance rules apply. If the call is done by
<literal>self</literal> then <literal>self</literal> is translated to
the current class, that is the class the code belongs to. Here also no
inheritance rules apply.
</para>
<para>
Static properties cannot be accessed through the object using the arrow
operator -&gt;.
</para>
<example>
<title>Static member example</title>
@ -49,7 +63,9 @@ print Foo::$my_static . "\n";
$foo = new Foo();
print $foo->staticValue() . "\n";
print $foo->my_static . "\n"; // Undefined my_static
print $foo->my_static . "\n"; // Undefined "Property" my_static
// $foo::my_static is not possible
print Bar::$my_static . "\n";
$bar = new Bar();