- Added examples

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@267159 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Felipe Pena 2008-10-10 18:12:54 +00:00
parent 66095fd370
commit 413b0c132a
4 changed files with 95 additions and 4 deletions

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.8 $ -->
<!-- $Revision: 1.9 $ -->
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.vprintf">
<refnamediv>
<refname>vprintf</refname>
@ -54,6 +54,22 @@
Returns the length of the outputted string.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>vprintf</function>: zero-padded integers</title>
<programlisting role="php">
<![CDATA[
<?php
vprintf("%04d-%02d-%02d", explode('-', '1988-8-1')); // 1988-08-01
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.8 $ -->
<!-- $Revision: 1.9 $ -->
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.vsprintf">
<refnamediv>
<refname>vsprintf</refname>
@ -51,6 +51,22 @@
for <function>sprintf</function>).
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>vsprintf</function>: zero-padded integers</title>
<programlisting role="php">
<![CDATA[
<?php
print vsprintf("%04d-%02d-%02d", explode('-', '1988-8-1')); // 1988-08-01
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.11 $ -->
<!-- $Revision: 1.12 $ -->
<refentry xml:id="function.gettype" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>gettype</refname>
@ -99,6 +99,38 @@
</itemizedlist>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>gettype</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$data = array(1, 1., NULL, new stdClass, 'foo');
foreach ($data as $value) {
echo gettype($value), "\n";
}
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
integer
double
NULL
object
string
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.8 $ -->
<!-- $Revision: 1.9 $ -->
<refentry xml:id="function.is-null" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>is_null</refname>
@ -39,6 +39,33 @@
otherwise.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>is_null</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
error_reporting(E_ALL);
$foo = NULL;
var_dump(is_null($inexistent), is_null($foo));
?>
]]>
</programlisting>
<screen>
<![CDATA[
Notice: Undefined variable: inexistent in ...
bool(true)
bool(true)
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>