ali Fri Aug 15 21:29:37 2003 EDT Modified files: /phpdoc/en/language variables.xml Log: fixed #20437 by adding a note Index: phpdoc/en/language/variables.xml diff -u phpdoc/en/language/variables.xml:1.68 phpdoc/en/language/variables.xml:1.69 --- phpdoc/en/language/variables.xml:1.68 Fri Jul 18 01:43:49 2003 +++ phpdoc/en/language/variables.xml Fri Aug 15 21:29:37 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.68 $ --> +<!-- $Revision: 1.69 $ --> <chapter id="language.variables"> <title>Variables</title> @@ -552,6 +552,33 @@ </programlisting> </example> </para> + + <note> + <para> + Static variables maybe declared as seen in the examples above. + Trying to assign values to these variables which are the + result of expressions will cause a parse error. + </para> + <para> + <example> + <title>Declaring static variables</title> + <programlisting role="php"> +<![CDATA[ +<?php +function foo(){ + static $int = 0; // correct + static $int = 1+2; // wrong (as it is an expression) + static $int = sqrt(121); // wrong (as it is an expression too) + + $int++; + echo $int; +} +?> +]]> + </programlisting> + </example> + </para> + </note> </sect2> <sect2 id="language.variables.scope.references">
-- PHP Documentation Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php