- Added example using nowdocs

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@257841 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Felipe Pena 2008-04-18 19:22:12 +00:00
parent 5b79026e5c
commit 4bc17b3724
2 changed files with 51 additions and 2 deletions

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.25 $ -->
<!-- $Revision: 1.26 $ -->
<sect1 xml:id="language.oop5.basic" xmlns="http://docbook.org/ns/docbook">
<title>The Basics</title>
@ -122,6 +122,30 @@ EOD;
Functions</link>.
</para>
</note>
<para>
Unlike heredocs, nowdocs can be used in any static data context.
<example>
<title>Static data example</title>
<programlisting role="php">
<![CDATA[
<?php
class foo {
// As of PHP 5.3.0
public $bar = <<<'EOT'
bar
EOT;
}
?>
]]>
</programlisting>
</example>
</para>
<note>
<para>
Nowdoc support was added in PHP 5.3.0.
</para>
</note>
</sect2>
<sect2 xml:id="language.oop5.basic.new">

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.15 $ -->
<!-- $Revision: 1.16 $ -->
<sect1 xml:id="language.oop5.constants" xmlns="http://docbook.org/ns/docbook">
<title>Class Constants</title>
<para>
@ -45,7 +45,32 @@ echo $class::constant."\n"; // As of PHP 5.3.0
]]>
</programlisting>
</example>
<example>
<title>Static data example</title>
<programlisting role="php">
<![CDATA[
<?php
class foo {
// As of PHP 5.3.0
const bar = <<<'EOT'
bar
EOT;
}
?>
]]>
</programlisting>
<para>
Unlike heredocs, nowdocs can be used in any static data context.
</para>
</example>
<note>
<para>
Nowdoc support was added in PHP 5.3.0.
</para>
</note>
</sect1>
<!-- Keep this comment at the end of the file