[PHP-DOC] cvs: phpdoc /en/functions strings.xml From: Andrei Zmievski (andrei <email protected>)
Date: 07/08/00

andrei Sat Jul 8 13:50:51 2000 EDT

  Modified files:
    /phpdoc/en/functions strings.xml
  Log:
  Documentation for str_pad().
  
  
Index: phpdoc/en/functions/strings.xml
diff -u phpdoc/en/functions/strings.xml:1.25 phpdoc/en/functions/strings.xml:1.26
--- phpdoc/en/functions/strings.xml:1.25 Sat Jul 8 06:50:19 2000
+++ phpdoc/en/functions/strings.xml Sat Jul 8 13:50:51 2000
@@ -1902,6 +1902,62 @@
    </refsect1>
   </refentry>
 
+ <refentry id="function.str-pad">
+ <refnamediv>
+ <refname>str_pad</refname>
+ <refpurpose>Pad a string to a certain length with another string</refpurpose>
+ </refnamediv>
+ <refsect1>
+ <title>Description</title>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef>string <function>str_pad</function></funcdef>
+ <paramdef>string <parameter>input</parameter></paramdef>
+ <paramdef>int <parameter>pad_length</parameter></paramdef>
+ <paramdef>string
+ <parameter><optional>pad_string</optional></parameter></paramdef>
+ <paramdef>int
+ <parameter><optional>pad_type</optional></parameter>
+ </paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ <para>
+ This functions pads the <parameter>input</parameter> string on
+ the left, the right, or both sides to the specifed padding
+ length. If the optional argument
+ <parameter>pad_string</parameter> is not supplied, the
+ <parameter>input</parameter> is padded with spaces, otherwise it
+ is padded with characters from <parameter>pad_string</parameter>
+ up to the limit.
+ </para>
+
+ <para>
+ Optional argument <parameter>pad_type</parameter> can be
+ STR_PAD_RIGHT, STR_PAD_LEFT, or STR_PAD_BOTH. If
+ <parameter>pad_type</parameter> is not specified it is assumed to
+ be STR_PAD_RIGHT.
+ </para>
+
+ <para>
+ If the value of <parameter>pad_length</parameter> is negative or
+ less than the length of the input string, no padding takes
+ place.
+ </para>
+
+ <para>
+ <example>
+ <title><function>str_pad</function> example</title>
+ <programlisting role="php">
+$input = "Alien";
+print str_pad($input, 10); // produces "Alien "
+print str_pad($input, 10, "-=", STR_PAD_LEFT); // produces "-=-=-Alien"
+print str_pad($input, 10, "_", STR_PAD_BOTH); // produces "__Alien___"
+ </programlisting>
+ </example>
+ </para>
+ </refsect1>
+ </refentry>
+
   <refentry id="function.strpos">
    <refnamediv>
     <refname>strpos</refname>