ordered text (a note about a parameter was on top, before any other text) and redesigned the example

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@157302 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Mehdi Achour 2004-04-27 21:45:48 +00:00
parent 8f9149cb4e
commit cdeed557c4

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.4 $ -->
<!-- $Revision: 1.5 $ -->
<!-- splitted from ./en/functions/strings.xml, last change in rev 1.2 -->
<refentry id="function.trim">
<refnamediv>
@ -15,12 +15,6 @@
<methodparam><type>string</type><parameter>str</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>charlist</parameter></methodparam>
</methodsynopsis>
<note>
<simpara>
The optional <parameter>charlist</parameter> parameter was
added in PHP 4.1.0
</simpara>
</note>
<para>
This function returns a string with whitespace stripped from the
beginning and end of <parameter>str</parameter>.
@ -80,19 +74,25 @@
<?php
$text = "\t\tThese are a few words :) ... ";
$trimmed = trim($text);
// $trimmed = "These are a few words :) ..."
$trimmed = trim($text, " \t.");
// $trimmed = "These are a few words :)"
$clean = trim($binary, "\x00..\x1F");
echo trim($text); // "These are a few words :) ..."
echo = trim($text, " \t."); // "These are a few words :)"
// trim the ASCII control characters at the beginning and end of $binary
// (from 0 to 31 inclusive)
$clean = trim($binary, "\x00..\x1F");
?>
]]>
</programlisting>
</para>
</example>
<note>
<simpara>
The optional <parameter>charlist</parameter> parameter was
added in PHP 4.1.0
</simpara>
</note>
<para>
See also <function>ltrim</function> and <function>rtrim</function>.
</para>