svn: /phpdoc/en/trunk/language/oop5/ constants.xml

From: Date: Thu, 14 May 2015 08:27:16 +0000
Subject: svn: /phpdoc/en/trunk/language/oop5/ constants.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-13296@lists.php.net to get a copy of this message
salathe Thu, 14 May 2015 08:27:16 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=336769 Log: Updated the class constants documentation to add an example and paragraph about using constant expressions, the feature added in 5.6.0 -- Provided by Ryan Pallas (derokorian@gmail.com) Changed paths: U phpdoc/en/trunk/language/oop5/constants.xml Modified: phpdoc/en/trunk/language/oop5/constants.xml =================================================================== --- phpdoc/en/trunk/language/oop5/constants.xml 2015-05-14 08:26:35 UTC (rev 336768) +++ phpdoc/en/trunk/language/oop5/constants.xml 2015-05-14 08:27:16 UTC (rev 336769) @@ -72,6 +72,32 @@ Nowdoc support was added in PHP 5.3.0. </para> </note> + + <example> + <title>Constant expression example</title> + <programlisting role="php"> +<![CDATA[ +<?php +const ONE = 1; + +class foo { + // As of PHP 5.6.0 + const TWO = ONE * 2; + const THREE = ONE + self::TWO; + const SENTENCE = 'The value of THREE is '.self::THREE; +} +?> +]]> + </programlisting> + <para> + It is possible to provide a scalar expression involving numeric and string literals and/or constants in context of a class constant. + </para> + </example> + <note> + <para> + Constant expression support was added in PHP 5.6.0. + </para> + </note> </sect1> <!-- Keep this comment at the end of the file

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