helly Thu Sep 30 14:22:30 2004 EDT
Modified files: /phpdoc/en/language/oop5 static.xml Log: - Upate http://cvs.php.net/diff.php/phpdoc/en/language/oop5/static.xml?r1=1.3&r2=1.4&ty=u Index: phpdoc/en/language/oop5/static.xml diff -u phpdoc/en/language/oop5/static.xml:1.3 phpdoc/en/language/oop5/static.xml:1.4 --- phpdoc/en/language/oop5/static.xml:1.3 Thu Aug 12 21:00:44 2004 +++ phpdoc/en/language/oop5/static.xml Thu Sep 30 14:22:30 2004 @@ -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 ->. + </para> <example> <title>Static member example</title> @@ -49,7 +63,9 @@ $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();