svn: /phpdoc/en/trunk/language/ functions.xml

From: Date: Sat, 17 Jul 2010 18:48:15 +0000
Subject: svn: /phpdoc/en/trunk/language/ functions.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-6892@lists.php.net to get a copy of this message
chx Sat, 17 Jul 2010 18:48:15 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=301351 Log: Documented the weird difference between classname::$foo and classname::$foo() Changed paths: U phpdoc/en/trunk/language/functions.xml Modified: phpdoc/en/trunk/language/functions.xml =================================================================== --- phpdoc/en/trunk/language/functions.xml 2010-07-17 17:47:06 UTC (rev 301350) +++ phpdoc/en/trunk/language/functions.xml 2010-07-17 18:48:15 UTC (rev 301351) @@ -541,6 +541,32 @@ </example> </para> <para> + When calling static methods, the function call is stronger than the static property operator: + <example> + <title>Variable method example with static properties</title> + <programlisting role="php"> +<![CDATA[ +<?php +class Foo +{ + static $variable = 'static property'; + static function Variable() + { + echo 'Method Variable called'; + } +} + +echo Foo::$variable; // This prints 'static propery'. It does need a $variable in this scope. +$variable = "Variable"; +Foo::$variable(); // This calls $foo->Variable() reading $variable in this scope. + +?> +]]> + </programlisting> + </example> + </para> + + <para> See also <function>call_user_func</function>, <link linkend="language.variables.variable"> variable variables</link> and <function>function_exists</function>.

« previous php.doc.cvs (#6892) next »