added more examples

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@203795 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Hartmut Holzgraefe 2005-12-27 21:12:53 +00:00
parent f953a0f164
commit aa2c16f491
2 changed files with 75 additions and 4 deletions

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.2 $ -->
<!-- $Revision: 1.3 $ -->
<!-- splitted from ./en/functions/outcontrol.xml, last change in rev 1.5 -->
<refentry id="function.ob-get-contents">
<refnamediv>
@ -15,8 +15,44 @@
<void/>
</methodsynopsis>
<para>
This will return the contents of the output buffer or &false;, if
output buffering isn't active.
This will return the contents of the output buffer without clearing it
or &false;, if output buffering isn't active.
</para>
<para>
<example>
<title>A simple <function>ob_get_contents</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
ob_start();
echo "Hello ";
$out1 = ob_get_contents();
echo "World";
$out2 = ob_get_contents();
ob_end_clean();
var_dump($out1, $out2);
?>
]]>
</programlisting>
<para>
Our example will output:
</para>
<screen>
<![CDATA[
string(6) "Hello "
string(11) "Hello World"
]]>
</screen>
</example>
</para>
<para>
See also <function>ob_start</function> and

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.3 $ -->
<!-- $Revision: 1.4 $ -->
<!-- splitted from ./en/functions/outcontrol.xml, last change in rev 1.22 -->
<refentry id="function.ob-get-length">
<refnamediv>
@ -18,6 +18,41 @@
This will return the length of the contents in the output buffer
or &false;, if output buffering isn't active.
</para>
<para>
<example>
<title>A simple <function>ob_get_contents</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
ob_start();
echo "Hello ";
$len1 = ob_get_length();
echo "World";
$len2 = ob_get_length();
ob_end_clean();
echo $len1 . ", ." . $len2;
?>
]]>
</programlisting>
<para>
Our example will output:
</para>
<screen>
<![CDATA[
6, 11
]]>
</screen>
</example>
</para>
<para>
See also <function>ob_start</function> and
<function>ob_get_contents</function>.