- Document php_strip_whitespace() with example.

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@165982 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Dave Barr 2004-08-10 23:28:14 +00:00
parent 4635f020c6
commit 5a7d3c7d8f

View file

@ -1,5 +1,5 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.1 $ -->
<!-- $Revision: 1.2 $ -->
<refentry id="function.php-strip-whitespace">
<refnamediv>
<refname>php_strip_whitespace</refname>
@ -8,13 +8,57 @@
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
&reftitle.description;
<methodsynopsis>
<type>string</type><methodname>php_strip_whitespace</methodname>
<methodparam><type>string</type><parameter>file_name</parameter></methodparam>
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
</methodsynopsis>
&warn.undocumented.func;
<para>
Returns the PHP source code in <parameter>filename</parameter> with
PHP comments and whitespace removed. This may be useful for determining the
amount of actual code in your scripts compared with the amount of comments.
</para>
</refsect1>
<refsect1>
&reftitle.returnvalues;
<para>
The stripped source code will be returned on success, or an empty string
on failure.
</para>
</refsect1>
<refsect1>
&reftitle.examples;
<para>
<example>
<title><function>php_strip_whitespace</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
// PHP comment here
/*
* Another PHP comment
*/
echo php_strip_whitespace($_SERVER['PHP_SELF']);
// Newlines are considered whitespace, and are removed too:
do_nothing();
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
<?php
echo php_strip_whitespace($_SERVER['PHP_SELF']); do_nothing(); ?>
]]>
</screen>
<para>
Notice the PHP comments are gone, as are the whitespace and newline
after the first echo statement.
</para>
</example>
</para>
</refsect1>
</refentry>