Add example section.

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@298753 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Daniel Convissor 2010-04-29 02:59:03 +00:00
parent 775021759a
commit bc56b6e4f1
2 changed files with 69 additions and 0 deletions

View file

@ -36,6 +36,37 @@
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title><function>DateTime::getTimestamp</function> example</title>
<para>&style.oop;</para>
<programlisting role="php">
<![CDATA[
<?php
$date = new DateTime();
echo $date->getTimestamp();
?>
]]>
</programlisting>
<para>&style.procedural;</para>
<programlisting role="php">
<![CDATA[
<?php
$date = date_create();
echo date_timestamp_get($date);
?>
]]>
</programlisting>
&examples.outputs.similar;
<screen>
<![CDATA[
1272509157
]]>
</screen>
</example>
</refsect1>
<refsect1 role="notes">
&reftitle.notes;
<para>

View file

@ -46,6 +46,44 @@
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title><function>DateTime::setTimestamp</function> example</title>
<para>&style.oop;</para>
<programlisting role="php">
<![CDATA[
<?php
$date = new DateTime();
echo $date->format('U = Y-m-d H:i:s') . "\n";
$date->setTimestamp(1171502725);
echo $date->format('U = Y-m-d H:i:s') . "\n";
?>
]]>
</programlisting>
<para>&style.procedural;</para>
<programlisting role="php">
<![CDATA[
<?php
$date = date_create();
echo date_format($date, 'U = Y-m-d H:i:s') . "\n";
date_timestamp_set($date, 1171502725);
echo date_format($date, 'U = Y-m-d H:i:s') . "\n";
?>
]]>
</programlisting>
&examples.outputs.similar;
<screen>
<![CDATA[
1272508903 = 2010-04-28 22:41:43
1171502725 = 2007-02-14 20:25:25
]]>
</screen>
</example>
</refsect1>
<refsect1 role="notes">
&reftitle.notes;
<para>