1999-06-06 18:51:02 +00:00
|
|
|
|
<reference id="ref.strings">
|
|
|
|
|
<title>String functions</title>
|
|
|
|
|
<titleabbrev>Strings</titleabbrev>
|
|
|
|
|
<partintro>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<simpara>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
These functions all manipulate strings in various ways. Some more
|
1999-09-13 18:07:16 +00:00
|
|
|
|
specialized sections can be found in the regular expression and
|
1999-10-20 22:41:42 +00:00
|
|
|
|
URL handling sections.</simpara>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</partintro>
|
|
|
|
|
|
1999-09-06 00:24:06 +00:00
|
|
|
|
<refentry id="function.addcslashes">
|
|
|
|
|
<refnamediv>
|
|
|
|
|
<refname>AddCSlashes</refname>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<refpurpose>Quote string with slashes in a C style</refpurpose>
|
1999-09-06 00:24:06 +00:00
|
|
|
|
</refnamediv>
|
|
|
|
|
<refsect1>
|
|
|
|
|
<title>Description</title>
|
|
|
|
|
<funcsynopsis>
|
|
|
|
|
<funcdef>string <function>addcslashes</function></funcdef>
|
|
|
|
|
<paramdef>string <parameter>str</parameter></paramdef>
|
|
|
|
|
<paramdef>string <parameter>charlist</parameter></paramdef>
|
|
|
|
|
</funcsynopsis>
|
|
|
|
|
<para>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
Returns a string with backslashes before characters that are
|
|
|
|
|
listed in <parameter>charlist</parameter> parameter. It escapes
|
|
|
|
|
<literal>\n</literal>, <literal>\r</literal> etc. in C-like
|
|
|
|
|
style, characters with ASCII code lower than 32 and higher than
|
|
|
|
|
126 are converted to octal representation. Be carefull when
|
|
|
|
|
escaping alphanumeric characters. You can specify a range in
|
|
|
|
|
<parameter>charlist</parameter> like "\0..\37", which would
|
|
|
|
|
escape all characters with ASCII code between 0 and 31.
|
1999-09-06 00:24:06 +00:00
|
|
|
|
<example>
|
|
|
|
|
<title>addcslashes() example</title>
|
|
|
|
|
<programlisting>
|
|
|
|
|
$escaped = addcslashes($not_escaped, "\0..\37!@\177..\377");
|
|
|
|
|
</programlisting></example>
|
|
|
|
|
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<note>
|
|
|
|
|
<simpara>
|
1999-10-20 22:41:42 +00:00
|
|
|
|
Added in PHP4b3-dev.</simpara>
|
|
|
|
|
</note></para>
|
1999-09-06 00:24:06 +00:00
|
|
|
|
|
|
|
|
|
<para>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
See also <function>stripcslashes</function>,
|
|
|
|
|
<function>stripslashes</function>,
|
|
|
|
|
<function>htmlspecialchars</function>,
|
|
|
|
|
<function>htmlspecialchars</function>, and
|
1999-10-20 22:41:42 +00:00
|
|
|
|
<function>quotemeta</function>.</para>
|
1999-09-06 00:24:06 +00:00
|
|
|
|
|
|
|
|
|
</refsect1>
|
|
|
|
|
</refentry>
|
|
|
|
|
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<refentry id="function.addslashes">
|
|
|
|
|
<refnamediv>
|
|
|
|
|
<refname>AddSlashes</refname>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<refpurpose>Quote string with slashes</refpurpose>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</refnamediv>
|
|
|
|
|
<refsect1>
|
|
|
|
|
<title>Description</title>
|
|
|
|
|
<funcsynopsis>
|
|
|
|
|
<funcdef>string <function>addslashes</function></funcdef>
|
|
|
|
|
<paramdef>string <parameter>str</parameter></paramdef>
|
|
|
|
|
</funcsynopsis>
|
|
|
|
|
<para>
|
|
|
|
|
Returns a string with backslashes before characters that need
|
|
|
|
|
to be quoted in database queries etc. These characters are
|
|
|
|
|
single quote (<literal>'</literal>), double quote
|
|
|
|
|
(<literal>"</literal>), backslash (<literal>\</literal>)
|
1999-10-20 22:41:42 +00:00
|
|
|
|
and NUL (the null byte).</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
|
|
|
|
|
<para>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
See also <function>stripslashes</function>,
|
|
|
|
|
<function>htmlspecialchars</function>, and
|
1999-10-20 22:41:42 +00:00
|
|
|
|
<function>quotemeta</function>.</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
|
|
|
|
|
</refsect1>
|
|
|
|
|
</refentry>
|
|
|
|
|
|
|
|
|
|
<refentry id="function.bin2hex">
|
|
|
|
|
<refnamediv>
|
|
|
|
|
<refname>bin2hex</refname>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<refpurpose>
|
|
|
|
|
Convert binary data into hexadecimal representation
|
|
|
|
|
</refpurpose>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</refnamediv>
|
|
|
|
|
<refsect1>
|
|
|
|
|
<title>Description</title>
|
|
|
|
|
<funcsynopsis>
|
|
|
|
|
<funcdef>string <function>bin2hex</function></funcdef>
|
|
|
|
|
<paramdef>string <parameter>str</parameter></paramdef>
|
|
|
|
|
</funcsynopsis>
|
|
|
|
|
<para>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
Returns an ASCII string containing the hexadecimal representation
|
|
|
|
|
of <parameter>str</parameter>. The conversion is done byte-wise
|
1999-10-20 22:41:42 +00:00
|
|
|
|
with the high-nibble first.</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
|
|
|
|
|
</refsect1>
|
|
|
|
|
</refentry>
|
|
|
|
|
|
|
|
|
|
<refentry id="function.chop">
|
|
|
|
|
<refnamediv>
|
|
|
|
|
<refname>Chop</refname>
|
|
|
|
|
<refpurpose>remove trailing whitespace</refpurpose>
|
|
|
|
|
</refnamediv>
|
|
|
|
|
<refsect1>
|
|
|
|
|
<title>Description</title>
|
|
|
|
|
<funcsynopsis>
|
|
|
|
|
<funcdef>string <function>chop</function></funcdef>
|
|
|
|
|
<paramdef>string <parameter>str</parameter></paramdef>
|
|
|
|
|
</funcsynopsis>
|
|
|
|
|
<para>
|
1999-11-15 00:36:18 +00:00
|
|
|
|
Returns the argument string without trailing whitespace, including newlines.
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<example>
|
|
|
|
|
<title>chop() example</title>
|
|
|
|
|
<programlisting>
|
|
|
|
|
$trimmed = Chop($line);
|
1999-10-20 22:41:42 +00:00
|
|
|
|
</programlisting></example></para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<para>
|
1999-10-20 22:41:42 +00:00
|
|
|
|
See also <function>trim</function>.</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
|
|
|
|
|
</refsect1>
|
|
|
|
|
</refentry>
|
|
|
|
|
|
|
|
|
|
<refentry id="function.chr">
|
|
|
|
|
<refnamediv>
|
|
|
|
|
<refname>Chr</refname>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<refpurpose>Return a specific character</refpurpose>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</refnamediv>
|
|
|
|
|
<refsect1>
|
|
|
|
|
<title>Description</title>
|
|
|
|
|
<funcsynopsis>
|
|
|
|
|
<funcdef>string <function>chr</function></funcdef>
|
|
|
|
|
<paramdef>int <parameter>ascii</parameter></paramdef>
|
|
|
|
|
</funcsynopsis>
|
|
|
|
|
<para>
|
|
|
|
|
Returns a one-character string containing the character specified
|
|
|
|
|
by <parameter>ascii</parameter>.
|
|
|
|
|
<example>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<title><function>chr</function> example</title>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<programlisting>
|
|
|
|
|
$str .= chr(27); /* add an escape character at the end of $str */
|
|
|
|
|
|
|
|
|
|
/* Often this is more useful */
|
|
|
|
|
$str = sprintf("The string ends in escape: %c", 27);
|
|
|
|
|
</programlisting></example>
|
|
|
|
|
|
|
|
|
|
This function complements <function>ord</function>. See also
|
|
|
|
|
<function>sprintf</function> with a format string of
|
1999-10-20 22:41:42 +00:00
|
|
|
|
<literal>%c</literal>.</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
|
|
|
|
|
</refsect1>
|
|
|
|
|
</refentry>
|
|
|
|
|
|
|
|
|
|
<refentry id="function.chunk-split">
|
|
|
|
|
<refnamediv>
|
|
|
|
|
<refname>chunk_split</refname>
|
|
|
|
|
<refpurpose>Split a string into smaller chunks</refpurpose>
|
|
|
|
|
</refnamediv>
|
|
|
|
|
<refsect1>
|
|
|
|
|
<title>Description</title>
|
|
|
|
|
<funcsynopsis>
|
|
|
|
|
<funcdef>string <function>chunk_split</function></funcdef>
|
|
|
|
|
<paramdef>string <parameter>string</parameter></paramdef>
|
|
|
|
|
<paramdef>int <parameter><optional>chunklen</optional>
|
|
|
|
|
</parameter></paramdef>
|
|
|
|
|
<paramdef>string <parameter><optional>end</optional>
|
|
|
|
|
</parameter></paramdef>
|
|
|
|
|
</funcsynopsis>
|
|
|
|
|
<para>
|
|
|
|
|
Can be used to split a string into smaller chunks which is useful
|
1999-10-20 22:41:42 +00:00
|
|
|
|
for e.g. converting <link linkend="function.base64-encode">base64_encode</link> output to
|
1999-06-16 14:27:15 +00:00
|
|
|
|
match RFC 2045 semantics. It inserts every
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<parameter>chunklen</parameter> (defaults to 76) chars the string
|
|
|
|
|
<parameter>end</parameter> (defaults to "\r\n"). It returns the
|
|
|
|
|
new string leaving the original string untouched.
|
|
|
|
|
<example>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<title><function>chunk_split</function> example</title>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<programlisting>
|
|
|
|
|
# format $data using RFC 2045 semantics
|
|
|
|
|
|
|
|
|
|
$new_string = chunk_split(base64_encode($data));
|
|
|
|
|
|
|
|
|
|
</programlisting></example>
|
|
|
|
|
|
|
|
|
|
This function is significantly faster than
|
|
|
|
|
<function>ereg_replace</function>.
|
1999-08-01 00:41:13 +00:00
|
|
|
|
|
|
|
|
|
<note>
|
|
|
|
|
<para>
|
1999-10-20 22:41:42 +00:00
|
|
|
|
This function was added in 3.0.6.</para>
|
|
|
|
|
</note></para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</refsect1>
|
|
|
|
|
</refentry>
|
|
|
|
|
|
|
|
|
|
<refentry id="function.convert-cyr-string">
|
|
|
|
|
<refnamediv>
|
|
|
|
|
<refname>convert_cyr_string</refname>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<refpurpose>
|
|
|
|
|
Convert from one Cyrillic character set to another
|
|
|
|
|
</refpurpose>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</refnamediv>
|
|
|
|
|
<refsect1>
|
|
|
|
|
<title>Description</title>
|
|
|
|
|
<funcsynopsis>
|
|
|
|
|
<funcdef>string <function>convert_cyr_string</function></funcdef>
|
|
|
|
|
<paramdef>string <parameter>str</parameter></paramdef>
|
|
|
|
|
<paramdef>string <parameter>from</parameter></paramdef>
|
|
|
|
|
<paramdef>string <parameter>to</parameter></paramdef>
|
|
|
|
|
</funcsynopsis>
|
|
|
|
|
<para>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
This function converts the given string from one Cyrillic
|
|
|
|
|
character set to another. The <parameter>from</parameter> and
|
|
|
|
|
<parameter>to</parameter> arguments are single characters that
|
|
|
|
|
represent the source and target Cyrillic character sets. The
|
|
|
|
|
supported types are:
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<itemizedlist>
|
|
|
|
|
<listitem><simpara>
|
1999-10-20 22:41:42 +00:00
|
|
|
|
k - koi8-r</simpara></listitem>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<listitem><simpara>
|
1999-10-20 22:41:42 +00:00
|
|
|
|
w - windows-1251</simpara></listitem>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<listitem><simpara>
|
1999-10-20 22:41:42 +00:00
|
|
|
|
i - iso8859-5</simpara></listitem>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<listitem><simpara>
|
1999-10-20 22:41:42 +00:00
|
|
|
|
a - x-cp866</simpara></listitem>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<listitem><simpara>
|
1999-10-20 22:41:42 +00:00
|
|
|
|
d - x-cp866</simpara></listitem>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<listitem><simpara>
|
1999-10-20 22:41:42 +00:00
|
|
|
|
m - x-mac-cyrillic</simpara></listitem>
|
|
|
|
|
</itemizedlist></para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</refsect1>
|
|
|
|
|
</refentry>
|
|
|
|
|
|
|
|
|
|
<refentry id="function.crypt">
|
|
|
|
|
<refnamediv>
|
|
|
|
|
<refname>crypt</refname>
|
|
|
|
|
<refpurpose>DES-encrypt a string</refpurpose>
|
|
|
|
|
</refnamediv>
|
|
|
|
|
<refsect1>
|
|
|
|
|
<title>Description</title>
|
|
|
|
|
<funcsynopsis>
|
|
|
|
|
<funcdef>string <function>crypt</function></funcdef>
|
|
|
|
|
<paramdef>string <parameter>str</parameter></paramdef>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<paramdef>string
|
|
|
|
|
<parameter><optional>salt</optional></parameter>
|
|
|
|
|
</paramdef>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</funcsynopsis>
|
|
|
|
|
|
|
|
|
|
<para>
|
|
|
|
|
<function>crypt</function> will encrypt a string using the
|
|
|
|
|
standard Unix <abbrev>DES</abbrev> encryption method. Arguments
|
|
|
|
|
are a string to be encrypted and an optional two-character salt
|
|
|
|
|
string to base the encryption on. See the Unix man page for your
|
1999-10-20 22:41:42 +00:00
|
|
|
|
crypt function for more information.</para>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<simpara>
|
|
|
|
|
If the salt argument is not provided, it will be randomly
|
1999-10-20 22:41:42 +00:00
|
|
|
|
generated by PHP.</simpara>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<simpara>
|
|
|
|
|
Some operating systems support more than one type of encryption.
|
|
|
|
|
In fact, sometimes the standard DES encryption is replaced by an
|
|
|
|
|
MD5 based encryption algorithm. The encryption type is triggered
|
|
|
|
|
by the salt argument. At install time, PHP determines the
|
|
|
|
|
capabilities of the crypt function and will accept salts for
|
|
|
|
|
other encryption types. If no salt is provided, PHP will
|
|
|
|
|
auto-generate a standard 2-character DES salt by default unless
|
|
|
|
|
the default encryption type on the system is MD5 in which case a
|
|
|
|
|
random MD5-compatible salt is generated. PHP sets a constant
|
|
|
|
|
named CRYPT_SALT_LENGTH which tells you whether a regular
|
|
|
|
|
2-character salt applies to your system or the longer 12-char MD5
|
1999-10-20 22:41:42 +00:00
|
|
|
|
salt is applicable.</simpara>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<simpara>
|
|
|
|
|
The standard DES encryption <function>crypt</function> contains
|
1999-10-20 22:41:42 +00:00
|
|
|
|
the salt as the first two characters of the output.</simpara>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<simpara>
|
|
|
|
|
On systems where the crypt() function supports multiple
|
|
|
|
|
encryption types, the following constants are set to 0 or 1
|
1999-10-20 22:41:42 +00:00
|
|
|
|
depending on whether the given type is available:</simpara>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<itemizedlist>
|
|
|
|
|
<listitem>
|
|
|
|
|
<simpara>
|
|
|
|
|
CRYPT_STD_DES - Standard DES encryption with a 2-char SALT
|
|
|
|
|
</simpara>
|
|
|
|
|
</listitem>
|
|
|
|
|
<listitem>
|
|
|
|
|
<simpara>
|
|
|
|
|
CRYPT_EXT_DES - Extended DES encryption with a 9-char SALT
|
|
|
|
|
</simpara>
|
|
|
|
|
</listitem>
|
|
|
|
|
<listitem>
|
|
|
|
|
<simpara>
|
|
|
|
|
CRYPT_MD5 - MD5 encryption with a 12-char SALT starting with
|
|
|
|
|
$1$
|
|
|
|
|
</simpara>
|
|
|
|
|
</listitem>
|
|
|
|
|
<listitem>
|
|
|
|
|
<simpara>
|
|
|
|
|
CRYPT_BLOWFISH - Extended DES encryption with a 16-char SALT
|
|
|
|
|
starting with $2$
|
|
|
|
|
</simpara>
|
|
|
|
|
</listitem>
|
|
|
|
|
</itemizedlist>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
|
|
|
|
|
<simpara>
|
|
|
|
|
There is no decrypt function, since <function>crypt</function>
|
1999-10-20 22:41:42 +00:00
|
|
|
|
uses a one-way algorithm.</simpara>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</refsect1>
|
|
|
|
|
</refentry>
|
|
|
|
|
|
|
|
|
|
<refentry id="function.echo">
|
|
|
|
|
<refnamediv>
|
|
|
|
|
<refname>echo</refname>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<refpurpose>Output one or more strings</refpurpose>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</refnamediv>
|
|
|
|
|
<refsect1>
|
|
|
|
|
<title>Description</title>
|
|
|
|
|
<funcsynopsis>
|
|
|
|
|
<funcdef><function>echo</function></funcdef>
|
|
|
|
|
<paramdef>string <parameter>arg1</parameter></paramdef>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<paramdef>string
|
|
|
|
|
<parameter><optional>argn</optional>...</parameter>
|
|
|
|
|
</paramdef>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</funcsynopsis>
|
|
|
|
|
<simpara>
|
1999-10-20 22:41:42 +00:00
|
|
|
|
Outputs all parameters.</simpara>
|
1999-06-21 22:16:42 +00:00
|
|
|
|
|
|
|
|
|
<para>
|
|
|
|
|
<function>echo</function> is not actually a function (it
|
|
|
|
|
is a language construct) so you are not required to use
|
|
|
|
|
parantheses with it.
|
1999-06-06 18:51:02 +00:00
|
|
|
|
|
|
|
|
|
<example><title>echo example</title>
|
|
|
|
|
<programlisting>
|
|
|
|
|
echo "Hello World";
|
1999-11-15 02:28:41 +00:00
|
|
|
|
|
|
|
|
|
echo "This spans
|
|
|
|
|
multiple lines. The newlines will be
|
|
|
|
|
output as well";
|
|
|
|
|
|
|
|
|
|
echo "This spans\nmultiple lines. The newlines will be\noutput as well.";
|
|
|
|
|
</programlisting>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</example>
|
|
|
|
|
</para>
|
|
|
|
|
|
1999-06-21 22:16:42 +00:00
|
|
|
|
<note>
|
|
|
|
|
<para>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
In fact, if you want to pass more than one parameter to echo,
|
|
|
|
|
you must not enclose the parameters within parentheses.
|
1999-06-21 22:16:42 +00:00
|
|
|
|
</para>
|
|
|
|
|
</note>
|
|
|
|
|
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<simpara>
|
|
|
|
|
See also:
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<function>print</function>,
|
|
|
|
|
<function>printf</function>, and
|
1999-10-20 22:41:42 +00:00
|
|
|
|
<function>flush</function>.</simpara>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
|
|
|
|
|
</refsect1>
|
|
|
|
|
</refentry>
|
|
|
|
|
|
|
|
|
|
<refentry id="function.explode">
|
|
|
|
|
<refnamediv>
|
|
|
|
|
<refname>explode</refname>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<refpurpose>Split a string by string</refpurpose>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</refnamediv>
|
|
|
|
|
<refsect1>
|
|
|
|
|
<title>Description</title>
|
|
|
|
|
<funcsynopsis>
|
|
|
|
|
<funcdef>array <function>explode</function></funcdef>
|
|
|
|
|
<paramdef>string <parameter>separator</parameter></paramdef>
|
|
|
|
|
<paramdef>string <parameter>string</parameter></paramdef>
|
|
|
|
|
</funcsynopsis>
|
|
|
|
|
<para>
|
|
|
|
|
|
|
|
|
|
Returns an array of strings containing the elements separated by
|
|
|
|
|
<replaceable>separator</replaceable>.
|
|
|
|
|
|
|
|
|
|
<example>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<title><function>explode</function> example</title>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<programlisting>
|
|
|
|
|
$pizza = "piece1 piece2 piece3 piece4 piece5 piece6";
|
|
|
|
|
$pieces = explode(" ", $pizza);
|
1999-10-20 22:41:42 +00:00
|
|
|
|
</programlisting></example></para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
|
|
|
|
|
<para>
|
|
|
|
|
See also <function>split</function> and
|
1999-10-20 22:41:42 +00:00
|
|
|
|
<function>implode</function>.</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
|
|
|
|
|
</refsect1>
|
|
|
|
|
</refentry>
|
|
|
|
|
|
|
|
|
|
<refentry id="function.flush">
|
|
|
|
|
<refnamediv>
|
|
|
|
|
<refname>flush</refname>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<refpurpose>Flush the output buffer</refpurpose>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</refnamediv>
|
|
|
|
|
<refsect1>
|
|
|
|
|
<title>Description</title>
|
|
|
|
|
<funcsynopsis>
|
|
|
|
|
<funcdef>void <function>flush</function></funcdef>
|
|
|
|
|
<void>
|
|
|
|
|
</funcsynopsis>
|
|
|
|
|
<simpara>
|
|
|
|
|
Flushes the output buffers of PHP and whatever backend PHP is
|
|
|
|
|
using (CGI, a web server, etc.) This effectively tries to push
|
1999-10-20 22:41:42 +00:00
|
|
|
|
all the output so far to the user's browser.</simpara>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
|
|
|
|
|
</refsect1>
|
|
|
|
|
</refentry>
|
|
|
|
|
|
|
|
|
|
<refentry id="function.get-meta-tags">
|
|
|
|
|
<refnamediv>
|
|
|
|
|
<refname>get_meta_tags</refname>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<refpurpose>
|
|
|
|
|
Extracts all meta tag content attributes from a file and returns
|
|
|
|
|
an array
|
|
|
|
|
</refpurpose>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</refnamediv>
|
|
|
|
|
<refsect1>
|
|
|
|
|
<title>Description</title>
|
|
|
|
|
<funcsynopsis>
|
|
|
|
|
<funcdef>array <function>get_meta_tags</function></funcdef>
|
|
|
|
|
<paramdef>string <parameter>filename</parameter></paramdef>
|
|
|
|
|
<paramdef>int
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<parameter><optional>use_include_path</optional></parameter>
|
|
|
|
|
</paramdef>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</funcsynopsis>
|
|
|
|
|
<para>
|
|
|
|
|
Opens <parameter>filename</parameter> and parses it line by line
|
|
|
|
|
for <meta> tags of the form
|
|
|
|
|
|
|
|
|
|
<example>
|
|
|
|
|
<title>Meta Tags Example</title>
|
|
|
|
|
<programlisting>
|
|
|
|
|
<meta name="author" content="name">
|
|
|
|
|
<meta name="tags" content="php3 documentation">
|
|
|
|
|
</head> <!-- parsing stops here -->
|
|
|
|
|
</programlisting></example>
|
|
|
|
|
|
1999-09-13 18:07:16 +00:00
|
|
|
|
(pay attention to line endings - PHP uses a native function to
|
1999-10-20 22:41:42 +00:00
|
|
|
|
parse the input, so a Mac file won't work on Unix).</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
|
|
|
|
|
<para>
|
|
|
|
|
The value of the name property becomes the key, the value of the
|
|
|
|
|
content property becomes the value of the returned array, so you
|
|
|
|
|
can easily use standard array functions to traverse it or access
|
|
|
|
|
single values. Special characters in the value of the name
|
|
|
|
|
property are substituted with '_', the rest is converted to lower
|
1999-10-20 22:41:42 +00:00
|
|
|
|
case.</para>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
Setting <parameter>use_include_path</parameter> to 1 will result
|
1999-10-20 22:41:42 +00:00
|
|
|
|
in PHP trying to open the file along the standard include path.</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</refsect1>
|
|
|
|
|
</refentry>
|
|
|
|
|
|
1999-09-05 23:11:23 +00:00
|
|
|
|
<refentry id="function.htmlentities">
|
|
|
|
|
<refnamediv>
|
|
|
|
|
<refname>htmlentities</refname>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<refpurpose>
|
|
|
|
|
Convert all applicable characters to HTML entities
|
|
|
|
|
</refpurpose>
|
1999-09-05 23:11:23 +00:00
|
|
|
|
</refnamediv>
|
|
|
|
|
<refsect1>
|
|
|
|
|
<title>Description</title>
|
|
|
|
|
<funcsynopsis>
|
|
|
|
|
<funcdef>string <function>htmlentities</function></funcdef>
|
|
|
|
|
<paramdef>string <parameter>string</parameter></paramdef>
|
|
|
|
|
</funcsynopsis>
|
|
|
|
|
<para>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
This function is identical to
|
|
|
|
|
<function>htmlspecialchars</function> in all ways, except that
|
|
|
|
|
all characters which have HTML entity equivalents are translated
|
1999-10-20 22:41:42 +00:00
|
|
|
|
into these entities.</para>
|
1999-09-05 23:11:23 +00:00
|
|
|
|
<para>
|
1999-10-20 22:41:42 +00:00
|
|
|
|
At present, the ISO-8859-1 character set is used.</para>
|
1999-09-05 23:11:23 +00:00
|
|
|
|
<para>
|
|
|
|
|
See also <function>htmlspecialchars</function> and
|
1999-10-20 22:41:42 +00:00
|
|
|
|
<function>nl2br</function>.</para>
|
1999-09-05 23:11:23 +00:00
|
|
|
|
|
|
|
|
|
</refsect1>
|
|
|
|
|
</refentry>
|
|
|
|
|
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<refentry id="function.htmlspecialchars">
|
|
|
|
|
<refnamediv>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<refname>htmlspecialchars</refname>
|
|
|
|
|
<refpurpose>
|
|
|
|
|
Convert special characters to HTML entities
|
|
|
|
|
</refpurpose>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</refnamediv>
|
|
|
|
|
<refsect1>
|
|
|
|
|
<title>Description</title>
|
|
|
|
|
<funcsynopsis>
|
|
|
|
|
<funcdef>string <function>htmlspecialchars</function></funcdef>
|
|
|
|
|
<paramdef>string <parameter>string</parameter></paramdef>
|
|
|
|
|
</funcsynopsis>
|
|
|
|
|
<para>
|
|
|
|
|
Certain characters have special significance in HTML, and should
|
|
|
|
|
be represented by HTML entities if they are to preserve their
|
|
|
|
|
meanings. This function returns a string with these conversions
|
1999-10-20 22:41:42 +00:00
|
|
|
|
made.</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<simpara>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
This function is useful in preventing user-supplied text from
|
|
|
|
|
containing HTML markup, such as in a message board or guest book
|
1999-10-20 22:41:42 +00:00
|
|
|
|
application.</simpara>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<para>
|
|
|
|
|
At present, the translations that are done are:
|
|
|
|
|
<itemizedlist>
|
|
|
|
|
<listitem>
|
|
|
|
|
<simpara>
|
1999-10-20 22:41:42 +00:00
|
|
|
|
'&' (ampersand) becomes '&amp;'</simpara></listitem>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<listitem>
|
|
|
|
|
<simpara>
|
1999-10-20 22:41:42 +00:00
|
|
|
|
'"' (double quote) becomes '&quot;'</simpara></listitem>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<listitem>
|
|
|
|
|
<simpara>
|
1999-10-20 22:41:42 +00:00
|
|
|
|
'<' (less than) becomes '&lt;'</simpara></listitem>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<listitem>
|
|
|
|
|
<simpara>
|
1999-10-20 22:41:42 +00:00
|
|
|
|
'>' (greater than) becomes '&gt;'</simpara></listitem>
|
|
|
|
|
</itemizedlist></para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
|
|
|
|
|
<para>
|
|
|
|
|
Note that this functions does not translate anything beyond what
|
1999-09-13 18:07:16 +00:00
|
|
|
|
is listed above. For full entity translation, see
|
1999-10-20 22:41:42 +00:00
|
|
|
|
<function>htmlentities</function>.</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
|
|
|
|
|
<para>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
See also <function>htmlentities</function> and
|
1999-10-20 22:41:42 +00:00
|
|
|
|
<function>nl2br</function>.</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
|
|
|
|
|
</refsect1>
|
|
|
|
|
</refentry>
|
|
|
|
|
|
|
|
|
|
<refentry id="function.implode">
|
|
|
|
|
<refnamediv>
|
|
|
|
|
<refname>implode</refname>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<refpurpose>Join array elements with a string</refpurpose>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</refnamediv>
|
|
|
|
|
<refsect1>
|
|
|
|
|
<title>Description</title>
|
|
|
|
|
<funcsynopsis>
|
|
|
|
|
<funcdef>string <function>implode</function></funcdef>
|
|
|
|
|
<paramdef>string <parameter>glue</parameter></paramdef>
|
1999-06-18 20:37:04 +00:00
|
|
|
|
<paramdef>array <parameter>pieces</parameter></paramdef>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</funcsynopsis>
|
|
|
|
|
<para>
|
|
|
|
|
Returns a string containing a string representation of all the
|
|
|
|
|
array elements in the same order, with the glue string between
|
|
|
|
|
each element.
|
|
|
|
|
<example>
|
|
|
|
|
<title>implode() example</title>
|
|
|
|
|
<programlisting>
|
1999-06-18 22:10:07 +00:00
|
|
|
|
$colon_separated = implode(":", $array);
|
1999-11-15 08:11:01 +00:00
|
|
|
|
</programlisting>
|
|
|
|
|
</example>
|
|
|
|
|
</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
|
|
|
|
|
<simpara>
|
|
|
|
|
See also <function>explode</function>, <function>join</function>,
|
1999-11-15 08:11:01 +00:00
|
|
|
|
and <function>split</function>.
|
|
|
|
|
</simpara>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
|
|
|
|
|
</refsect1>
|
|
|
|
|
</refentry>
|
|
|
|
|
|
|
|
|
|
<refentry id="function.join">
|
|
|
|
|
<refnamediv>
|
|
|
|
|
<refname>join</refname>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<refpurpose>Join array elements with a string</refpurpose>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</refnamediv>
|
|
|
|
|
<refsect1>
|
|
|
|
|
<title>Description</title>
|
|
|
|
|
<funcsynopsis>
|
|
|
|
|
<funcdef>string <function>join</function></funcdef>
|
|
|
|
|
<paramdef>string <parameter>glue</parameter></paramdef>
|
1999-06-18 22:10:07 +00:00
|
|
|
|
<paramdef>array <parameter>pieces</parameter></paramdef>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</funcsynopsis>
|
|
|
|
|
|
|
|
|
|
<simpara>
|
|
|
|
|
<function>join</function> is an alias to
|
1999-11-15 08:11:01 +00:00
|
|
|
|
<function>implode</function>, and is identical in every way.
|
|
|
|
|
</simpara>
|
|
|
|
|
|
|
|
|
|
<simpara>
|
|
|
|
|
See also <function>explode</function>, <function>implode</function>,
|
|
|
|
|
and <function>split</function>.
|
|
|
|
|
</simpara>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
|
|
|
|
|
</refsect1>
|
|
|
|
|
</refentry>
|
|
|
|
|
|
|
|
|
|
<refentry id="function.ltrim">
|
|
|
|
|
<refnamediv>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<refname>ltrim</refname>
|
|
|
|
|
<refpurpose>
|
|
|
|
|
Strip whitespace from the beginning of a string
|
|
|
|
|
</refpurpose>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</refnamediv>
|
|
|
|
|
<refsect1>
|
|
|
|
|
<title>Description</title>
|
|
|
|
|
<funcsynopsis>
|
|
|
|
|
<funcdef>string <function>ltrim</function></funcdef>
|
|
|
|
|
<paramdef>string <parameter>str</parameter></paramdef>
|
|
|
|
|
</funcsynopsis>
|
|
|
|
|
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<para>
|
|
|
|
|
This function strips whitespace from the start of a string and
|
1999-10-20 22:41:42 +00:00
|
|
|
|
returns the stripped string.</para>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<para>
|
1999-10-20 22:41:42 +00:00
|
|
|
|
See also <function>chop</function> and <function>trim</function>.</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
|
|
|
|
|
</refsect1>
|
|
|
|
|
</refentry>
|
|
|
|
|
|
|
|
|
|
<refentry id="function.md5">
|
|
|
|
|
<refnamediv>
|
|
|
|
|
<refname>md5</refname>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<refpurpose>Calculate the md5 hash of a string</refpurpose>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</refnamediv>
|
|
|
|
|
<refsect1>
|
|
|
|
|
<title>Description</title>
|
|
|
|
|
<funcsynopsis>
|
|
|
|
|
<funcdef>string <function>md5</function></funcdef>
|
|
|
|
|
<paramdef>string <parameter>str</parameter></paramdef>
|
|
|
|
|
</funcsynopsis>
|
|
|
|
|
|
|
|
|
|
<para>
|
|
|
|
|
Calculates the MD5 hash of <parameter>str</parameter> using the
|
|
|
|
|
<ulink url="http://ds.internic.net/rfc/rfc1321.txt">RSA Data
|
1999-10-20 22:41:42 +00:00
|
|
|
|
Security, Inc. MD5 Message-Digest Algorithm</ulink>.</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
|
|
|
|
|
</refsect1>
|
|
|
|
|
</refentry>
|
|
|
|
|
|
1999-09-13 16:15:17 +00:00
|
|
|
|
<refentry id="function.metaphone">
|
|
|
|
|
<refnamediv>
|
|
|
|
|
<refname>Metaphone</refname>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<refpurpose>Calculate the metaphone key of a string</refpurpose>
|
1999-09-13 16:15:17 +00:00
|
|
|
|
</refnamediv>
|
|
|
|
|
<refsect1>
|
|
|
|
|
<title>Description</title>
|
|
|
|
|
<funcsynopsis>
|
|
|
|
|
<funcdef>string <function>metaphone</function></funcdef>
|
|
|
|
|
<paramdef>string <parameter>str</parameter></paramdef>
|
|
|
|
|
</funcsynopsis>
|
|
|
|
|
<para>
|
1999-10-20 22:41:42 +00:00
|
|
|
|
Calculates the metaphone key of <parameter>str</parameter>.</para>
|
1999-09-13 16:15:17 +00:00
|
|
|
|
<para>
|
1999-09-13 16:48:55 +00:00
|
|
|
|
Similar to <function>soundex</function> metaphone creates the
|
|
|
|
|
same key for similar sounding words. It's more accurate than
|
|
|
|
|
<function>soundex</function> as it knows the basic rules of
|
|
|
|
|
English pronunciation. the metaphone generated keys are of
|
1999-10-20 22:41:42 +00:00
|
|
|
|
variable length.</para>
|
1999-09-13 16:15:17 +00:00
|
|
|
|
<para>
|
1999-09-13 16:48:55 +00:00
|
|
|
|
Metaphone was developed by Lawrence Philips
|
|
|
|
|
<lphilips@verity.com>. It is described in ["Practical
|
|
|
|
|
Algorithms for Programmers", Binstock & Rex, Addison Wesley,
|
|
|
|
|
1995].
|
1999-09-13 16:15:17 +00:00
|
|
|
|
<note>
|
|
|
|
|
<para>
|
1999-10-20 22:41:42 +00:00
|
|
|
|
This function was added in PHP 4.0.</para>
|
|
|
|
|
</note></para>
|
1999-09-13 16:15:17 +00:00
|
|
|
|
</refsect1>
|
|
|
|
|
</refentry>
|
|
|
|
|
|
|
|
|
|
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<refentry id="function.nl2br">
|
|
|
|
|
<refnamediv>
|
|
|
|
|
<refname>nl2br</refname>
|
|
|
|
|
<refpurpose>Converts newlines to HTML line breaks.</refpurpose>
|
|
|
|
|
</refnamediv>
|
|
|
|
|
<refsect1>
|
|
|
|
|
<title>Description</title>
|
|
|
|
|
<funcsynopsis>
|
|
|
|
|
<funcdef>string <function>nl2br</function></funcdef>
|
|
|
|
|
<paramdef>string <parameter>string</parameter></paramdef>
|
|
|
|
|
</funcsynopsis>
|
|
|
|
|
|
|
|
|
|
<para>
|
|
|
|
|
Returns <parameter>string</parameter> with '<BR>' inserted
|
1999-10-20 22:41:42 +00:00
|
|
|
|
before all newlines.</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
|
|
|
|
|
<para>
|
|
|
|
|
See also <function>htmlspecialchars</function> and
|
1999-10-20 22:41:42 +00:00
|
|
|
|
<function>htmlentities</function>.</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
|
|
|
|
|
</refsect1>
|
|
|
|
|
</refentry>
|
|
|
|
|
|
|
|
|
|
<refentry id="function.ord">
|
|
|
|
|
<refnamediv>
|
|
|
|
|
<refname>Ord</refname>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<refpurpose>Return ASCII value of character</refpurpose>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</refnamediv>
|
|
|
|
|
<refsect1>
|
|
|
|
|
<title>Description</title>
|
|
|
|
|
<funcsynopsis>
|
|
|
|
|
<funcdef>int <function>ord</function></funcdef>
|
|
|
|
|
<paramdef>string <parameter>string</parameter></paramdef>
|
|
|
|
|
</funcsynopsis>
|
|
|
|
|
<para>
|
|
|
|
|
Returns the ASCII value of the first character of
|
|
|
|
|
<parameter>string</parameter>. This function complements
|
|
|
|
|
<function>chr</function>.
|
|
|
|
|
<example>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<title><function>ord</function> example</title>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<programlisting>
|
|
|
|
|
if (ord($str) == 10) {
|
1999-09-13 18:07:16 +00:00
|
|
|
|
echo "The first character of \$str is a line feed.\n";
|
1999-06-06 18:51:02 +00:00
|
|
|
|
}
|
1999-10-20 22:41:42 +00:00
|
|
|
|
</programlisting></example></para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
|
|
|
|
|
<simpara>
|
1999-10-20 22:41:42 +00:00
|
|
|
|
See also <function>chr</function>.</simpara>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
|
|
|
|
|
</refsect1>
|
|
|
|
|
</refentry>
|
|
|
|
|
|
|
|
|
|
<refentry id="function.parse-str">
|
|
|
|
|
<refnamediv>
|
|
|
|
|
<refname>parse_str</refname>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<refpurpose>Parses the string into variables</refpurpose>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</refnamediv>
|
|
|
|
|
<refsect1>
|
|
|
|
|
<title>Description</title>
|
|
|
|
|
<funcsynopsis>
|
|
|
|
|
<funcdef>void <function>parse_str</function></funcdef>
|
|
|
|
|
<paramdef>string <parameter>str</parameter></paramdef>
|
|
|
|
|
</funcsynopsis>
|
|
|
|
|
|
|
|
|
|
<para>
|
|
|
|
|
Parses <parameter>str</parameter> as if it were the query string
|
1999-10-20 22:41:42 +00:00
|
|
|
|
passed via an URL and sets variables in the current scope.</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
|
|
|
|
|
<para>
|
|
|
|
|
<example>
|
|
|
|
|
<title>Using <function>parse_str</function></title>
|
|
|
|
|
<programlisting>
|
|
|
|
|
$str = "first=value&second[]=this+works&second[]=another";
|
|
|
|
|
parse_str($str);
|
|
|
|
|
echo $first; /* prints "value" */
|
|
|
|
|
echo $second[0]; /* prints "this works" */
|
|
|
|
|
echo $second[1]; /* prints "another" */
|
|
|
|
|
</programlisting>
|
1999-10-20 22:41:42 +00:00
|
|
|
|
</example></para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</refsect1>
|
|
|
|
|
</refentry>
|
|
|
|
|
|
|
|
|
|
<refentry id="function.print">
|
|
|
|
|
<refnamediv>
|
|
|
|
|
<refname>print</refname>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<refpurpose>Output a string</refpurpose>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</refnamediv>
|
|
|
|
|
<refsect1>
|
|
|
|
|
<title>Description</title>
|
|
|
|
|
<funcsynopsis>
|
|
|
|
|
<funcdef><function>print</function></funcdef>
|
|
|
|
|
<paramdef>string <parameter>arg</parameter></paramdef>
|
|
|
|
|
</funcsynopsis>
|
|
|
|
|
<simpara>
|
1999-10-20 22:41:42 +00:00
|
|
|
|
Outputs <parameter>arg</parameter>.</simpara>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
|
|
|
|
|
<simpara>
|
|
|
|
|
See also:
|
|
|
|
|
<function>echo</function>
|
|
|
|
|
<function>printf</function>
|
1999-10-20 22:41:42 +00:00
|
|
|
|
<function>flush</function></simpara>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
|
|
|
|
|
</refsect1>
|
|
|
|
|
</refentry>
|
|
|
|
|
|
|
|
|
|
<refentry id="function.printf">
|
|
|
|
|
<refnamediv>
|
|
|
|
|
<refname>printf</refname>
|
|
|
|
|
<refpurpose>output a formatted string</refpurpose>
|
|
|
|
|
</refnamediv>
|
|
|
|
|
<refsect1>
|
|
|
|
|
<title>Description</title>
|
|
|
|
|
<funcsynopsis>
|
|
|
|
|
<funcdef>int <function>printf</function></funcdef>
|
|
|
|
|
<paramdef>string <parameter>format</parameter></paramdef>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<paramdef>mixed
|
|
|
|
|
<parameter><optional>args</optional></parameter>...
|
|
|
|
|
</paramdef>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</funcsynopsis>
|
|
|
|
|
|
|
|
|
|
<simpara>
|
|
|
|
|
Produces output according to <parameter>format</parameter>, which
|
1999-10-20 22:41:42 +00:00
|
|
|
|
is described in the documentation for <function>sprintf</function>.</simpara>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
|
|
|
|
|
<simpara>
|
|
|
|
|
See also:
|
|
|
|
|
<function>print</function>,
|
|
|
|
|
<function>sprintf</function>, and
|
1999-10-20 22:41:42 +00:00
|
|
|
|
<function>flush</function>.</simpara>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
|
|
|
|
|
</refsect1>
|
|
|
|
|
</refentry>
|
|
|
|
|
|
|
|
|
|
<refentry id="function.quoted-printable-decode">
|
|
|
|
|
<refnamediv>
|
|
|
|
|
<refname>quoted_printable_decode</refname>
|
1999-10-20 22:41:42 +00:00
|
|
|
|
<refpurpose>Convert a quoted-printable string to an 8 bit string</refpurpose>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</refnamediv>
|
|
|
|
|
<refsect1>
|
|
|
|
|
<title>Description</title>
|
|
|
|
|
<funcsynopsis>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<funcdef>string
|
|
|
|
|
<function>quoted_printable_decode</function>
|
|
|
|
|
</funcdef>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<paramdef>string <parameter>str</parameter></paramdef>
|
|
|
|
|
</funcsynopsis>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<simpara>
|
|
|
|
|
This function returns an 8-bit binary string corresponding to the
|
|
|
|
|
decoded quoted printable string. This function is similar to
|
|
|
|
|
<function>imap_qprint</function>, except this one does not
|
1999-10-20 22:41:42 +00:00
|
|
|
|
require the IMAP module to work.</simpara>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</refsect1>
|
|
|
|
|
</refentry>
|
|
|
|
|
|
|
|
|
|
<refentry id="function.quotemeta">
|
|
|
|
|
<refnamediv>
|
|
|
|
|
<refname>QuoteMeta</refname>
|
|
|
|
|
<refpurpose>quote meta characters</refpurpose>
|
|
|
|
|
</refnamediv>
|
|
|
|
|
<refsect1>
|
|
|
|
|
<title>Description</title>
|
|
|
|
|
<funcsynopsis>
|
1999-07-17 19:42:51 +00:00
|
|
|
|
<funcdef>string <function>quotemeta</function></funcdef>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<paramdef>string <parameter>str</parameter></paramdef>
|
|
|
|
|
</funcsynopsis>
|
|
|
|
|
<para>
|
|
|
|
|
Returns a version of str with a backslash character
|
|
|
|
|
(<literal>\</literal>) before every character that is among
|
1999-10-20 22:41:42 +00:00
|
|
|
|
these: <screen>. \\ + * ? [ ^ ] ( $ )</screen></para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
|
|
|
|
|
<simpara>
|
|
|
|
|
See also <function>addslashes</function>,
|
|
|
|
|
<function>htmlentities</function>,
|
|
|
|
|
<function>htmlspecialchars</function>,
|
|
|
|
|
<function>nl2br</function>, and
|
1999-10-20 22:41:42 +00:00
|
|
|
|
<function>stripslashes</function>.</simpara>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
|
|
|
|
|
</refsect1>
|
|
|
|
|
</refentry>
|
|
|
|
|
|
|
|
|
|
<refentry id="function.rawurldecode">
|
|
|
|
|
<refnamediv>
|
|
|
|
|
<refname>rawurldecode</refname>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<refpurpose>Decode URL-encoded strings</refpurpose>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</refnamediv>
|
|
|
|
|
<refsect1>
|
|
|
|
|
<title>Description</title>
|
|
|
|
|
<funcsynopsis>
|
|
|
|
|
<funcdef>string <function>rawurldecode</function></funcdef>
|
|
|
|
|
<paramdef>string <parameter>str</parameter></paramdef>
|
|
|
|
|
</funcsynopsis>
|
|
|
|
|
<para>
|
|
|
|
|
Returns a string in which the sequences with percent
|
|
|
|
|
(<literal>%</literal>) signs followed by two hex digits have been
|
|
|
|
|
replaced with literal characters. For example, the string
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<screen>foo%20bar%40baz</screen> decodes into <screen>foo
|
1999-10-20 22:41:42 +00:00
|
|
|
|
bar@baz</screen></para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
|
|
|
|
|
<simpara>
|
1999-10-20 22:41:42 +00:00
|
|
|
|
See also <function>rawurlencode</function>.</simpara>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
|
|
|
|
|
</refsect1>
|
|
|
|
|
</refentry>
|
|
|
|
|
|
|
|
|
|
<refentry id="function.rawurlencode">
|
|
|
|
|
<refnamediv>
|
|
|
|
|
<refname>rawurlencode</refname>
|
|
|
|
|
<refpurpose>URL-encode according to RFC1738</refpurpose>
|
|
|
|
|
</refnamediv>
|
|
|
|
|
<refsect1>
|
|
|
|
|
<title>Description</title>
|
|
|
|
|
<funcsynopsis>
|
|
|
|
|
<funcdef>string <function>rawurlencode</function></funcdef>
|
|
|
|
|
<paramdef>string <parameter>str</parameter></paramdef>
|
|
|
|
|
</funcsynopsis>
|
|
|
|
|
<para>
|
|
|
|
|
Returns a string in which all non-alphanumeric characters except
|
|
|
|
|
<screen>-_.</screen> have been replaced with a percent
|
|
|
|
|
(<literal>%</literal>) sign followed by two hex digits. This is
|
|
|
|
|
the encoding described in RFC1738 for protecting literal
|
|
|
|
|
characters from being interpreted as special URL delimiters, and
|
|
|
|
|
for protecting URL's from being mangled by transmission media
|
|
|
|
|
with character conversions (like some email systems). For
|
|
|
|
|
example, if you want to include a password in an ftp url:
|
|
|
|
|
<example>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<title><function>rawurlencode</function> example 1</title>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<programlisting>
|
|
|
|
|
echo '<A HREF="ftp://user:', rawurlencode ('foo @+%/'),
|
|
|
|
|
'@ftp.my.com/x.txt">';
|
|
|
|
|
</programlisting></example>
|
|
|
|
|
|
|
|
|
|
Or, if you pass information in a path info component of the url:
|
|
|
|
|
|
|
|
|
|
<example>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<title><function>rawurlencode</function> example 2</title>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<programlisting>
|
|
|
|
|
echo '<A HREF="http://x.com/department_list_script/',
|
|
|
|
|
rawurlencode ('sales and marketing/Miami'), '">';
|
1999-10-20 22:41:42 +00:00
|
|
|
|
</programlisting></example></para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
|
|
|
|
|
<simpara>
|
1999-10-20 22:41:42 +00:00
|
|
|
|
See also <function>rawurldecode</function>.</simpara>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
|
|
|
|
|
</refsect1>
|
|
|
|
|
</refentry>
|
|
|
|
|
|
|
|
|
|
<refentry id="function.setlocale">
|
|
|
|
|
<refnamediv>
|
|
|
|
|
<refname>setlocale</refname>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<refpurpose>Set locale information</refpurpose>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</refnamediv>
|
|
|
|
|
<refsect1>
|
|
|
|
|
<title>Description</title>
|
|
|
|
|
<funcsynopsis>
|
|
|
|
|
<funcdef>string <function>setlocale</function></funcdef>
|
|
|
|
|
<paramdef>string <parameter>category</parameter></paramdef>
|
|
|
|
|
<paramdef>string <parameter>locale</parameter></paramdef>
|
|
|
|
|
</funcsynopsis>
|
|
|
|
|
<para>
|
|
|
|
|
<parameter>category</parameter> is a string specifying the
|
|
|
|
|
category of the functions affected by the locale setting:
|
|
|
|
|
<itemizedlist>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<listitem>
|
|
|
|
|
<simpara>
|
|
|
|
|
LC_ALL for all of the below
|
|
|
|
|
</simpara>
|
|
|
|
|
</listitem>
|
|
|
|
|
<listitem>
|
|
|
|
|
<simpara>
|
|
|
|
|
LC_COLLATE for string comparison - not currently implemented in PHP
|
|
|
|
|
</simpara>
|
|
|
|
|
</listitem>
|
|
|
|
|
<listitem>
|
|
|
|
|
<simpara>
|
|
|
|
|
LC_CTYPE for character classification and conversion, for
|
|
|
|
|
example <function>strtoupper</function>
|
|
|
|
|
</simpara>
|
|
|
|
|
</listitem>
|
|
|
|
|
<listitem>
|
|
|
|
|
<simpara>
|
|
|
|
|
LC_MONETARY for localeconv() - not currently implemented in
|
|
|
|
|
PHP
|
|
|
|
|
</simpara>
|
|
|
|
|
</listitem>
|
|
|
|
|
<listitem>
|
|
|
|
|
<simpara>
|
|
|
|
|
LC_NUMERIC for decimal separator
|
|
|
|
|
</simpara>
|
|
|
|
|
</listitem>
|
|
|
|
|
<listitem>
|
|
|
|
|
<simpara>
|
|
|
|
|
LC_TIME for date and time formatting with
|
|
|
|
|
<function>strftime</function>
|
|
|
|
|
</simpara>
|
|
|
|
|
</listitem>
|
1999-10-20 22:41:42 +00:00
|
|
|
|
</itemizedlist></para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
|
|
|
|
|
<para>
|
|
|
|
|
If <parameter>locale</parameter> is the empty string
|
|
|
|
|
<literal>""</literal>, the locale names will be set from the
|
|
|
|
|
values of environment variables with the same names as the above
|
1999-10-20 22:41:42 +00:00
|
|
|
|
categories, or from "LANG".</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
|
|
|
|
|
<para>
|
|
|
|
|
If locale is zero or <literal>"0"</literal>, the locale setting
|
1999-10-20 22:41:42 +00:00
|
|
|
|
is not affected, only the current setting is returned.</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
|
|
|
|
|
<para>
|
|
|
|
|
Setlocale returns the new current locale, or false if the locale
|
|
|
|
|
functionality is not implemented in the plattform, the specified
|
|
|
|
|
locale does not exist or the category name is invalid.
|
1999-10-20 22:41:42 +00:00
|
|
|
|
An invalid category name also causes a warning message.</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
|
|
|
|
|
</refsect1>
|
|
|
|
|
</refentry>
|
|
|
|
|
|
|
|
|
|
<refentry id="function.similar-text">
|
|
|
|
|
<refnamediv>
|
|
|
|
|
<refname>similar_text</refname>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<refpurpose>Calculate the similarity between two strings</refpurpose>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</refnamediv>
|
|
|
|
|
<refsect1>
|
|
|
|
|
<title>Description</title>
|
|
|
|
|
<funcsynopsis>
|
|
|
|
|
<funcdef>int <function>similar_text</function></funcdef>
|
|
|
|
|
<paramdef>string <parameter>first</parameter></paramdef>
|
|
|
|
|
<paramdef>string <parameter>second</parameter></paramdef>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<paramdef>double
|
|
|
|
|
<parameter><optional>percent</optional></parameter>
|
|
|
|
|
</paramdef>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</funcsynopsis>
|
|
|
|
|
|
|
|
|
|
<para>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
This calculates the similarity between two strings as described
|
|
|
|
|
in Oliver [1993]. Note that this implementation does not use a
|
|
|
|
|
stack as in Oliver's pseudo code, but recursive calls which may
|
|
|
|
|
or may not speed up the whole process. Note also that the
|
|
|
|
|
complexity of this algorithm is O(N**3) where N is the length of
|
1999-10-20 22:41:42 +00:00
|
|
|
|
the longest string.</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
|
|
|
|
|
<para>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
By passing a reference as third argument,
|
|
|
|
|
<function>similar_text</function> will calculate the similarity
|
|
|
|
|
in percent for you. It returns the number of matching chars in
|
1999-10-20 22:41:42 +00:00
|
|
|
|
both strings.</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</refsect1>
|
|
|
|
|
</refentry>
|
|
|
|
|
|
|
|
|
|
<refentry id="function.soundex">
|
|
|
|
|
<refnamediv>
|
|
|
|
|
<refname>soundex</refname>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<refpurpose>Calculate the soundex key of a string</refpurpose>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</refnamediv>
|
|
|
|
|
<refsect1>
|
|
|
|
|
<title>Description</title>
|
|
|
|
|
<funcsynopsis>
|
|
|
|
|
<funcdef>string <function>soundex</function></funcdef>
|
|
|
|
|
<paramdef>string <parameter>str</parameter></paramdef>
|
|
|
|
|
</funcsynopsis>
|
|
|
|
|
|
|
|
|
|
<para>
|
1999-10-20 22:41:42 +00:00
|
|
|
|
Calculates the soundex key of <parameter>str</parameter>.</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<para>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
Soundex keys have the property that words pronounced similarly
|
|
|
|
|
produce the same soundex key, and can thus be used to simplify
|
|
|
|
|
searches in databases where you know the pronunciation but not
|
|
|
|
|
the spelling. This soundex function returns a string 4 characters
|
1999-10-20 22:41:42 +00:00
|
|
|
|
long, starting with a letter.</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<para>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
This particular soundex function is one described by Donald Knuth
|
|
|
|
|
in "The Art Of Computer Programming, vol. 3: Sorting And
|
1999-10-20 22:41:42 +00:00
|
|
|
|
Searching", Addison-Wesley (1973), pp. 391-392.</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<para>
|
|
|
|
|
<example>
|
|
|
|
|
<title>Soundex Examples</title>
|
|
|
|
|
<programlisting>
|
|
|
|
|
soundex("Euler") == soundex("Ellery") == 'E460';
|
|
|
|
|
soundex("Gauss") == soundex("Ghosh") == 'G200';
|
|
|
|
|
soundex("Knuth") == soundex("Kant") == 'H416';
|
|
|
|
|
soundex("Lloyd") == soundex("Ladd") == 'L300';
|
|
|
|
|
soundex("Lukasiewicz") == soundex("Lissajous") == 'L222';
|
|
|
|
|
</programlisting>
|
1999-10-20 22:41:42 +00:00
|
|
|
|
</example></para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</refsect1>
|
|
|
|
|
</refentry>
|
|
|
|
|
|
|
|
|
|
<refentry id="function.sprintf">
|
|
|
|
|
<refnamediv>
|
|
|
|
|
<refname>sprintf</refname>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<refpurpose>Return a formatted string</refpurpose>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</refnamediv>
|
|
|
|
|
<refsect1>
|
|
|
|
|
<title>Description</title>
|
|
|
|
|
<funcsynopsis>
|
1999-10-18 19:41:58 +00:00
|
|
|
|
<funcdef>string <function>sprintf</function></funcdef>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<paramdef>string <parameter>format</parameter></paramdef>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<paramdef>mixed
|
|
|
|
|
<parameter><optional>args</optional></parameter>...
|
|
|
|
|
</paramdef>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</funcsynopsis>
|
|
|
|
|
|
|
|
|
|
<simpara>
|
|
|
|
|
Returns a string produced according to the formatting string
|
1999-10-20 22:41:42 +00:00
|
|
|
|
<parameter>format</parameter>.</simpara>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
|
|
|
|
|
<simpara>
|
|
|
|
|
The format string is composed by zero or more directives:
|
|
|
|
|
ordinary characters (excluding <literal>%</literal>) that are
|
|
|
|
|
copied directly to the result, and <emphasis>conversion
|
|
|
|
|
specifications</emphasis>, each of which results in fetching its
|
|
|
|
|
own parameter. This applies to both <function>sprintf</function>
|
1999-10-20 22:41:42 +00:00
|
|
|
|
and <function>printf</function>.</simpara>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
|
|
|
|
|
<para>
|
|
|
|
|
Each conversion specification consists of these elements, in
|
|
|
|
|
order:
|
|
|
|
|
<orderedlist>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<listitem>
|
|
|
|
|
<simpara>
|
|
|
|
|
An optional <emphasis>padding specifier</emphasis> that says
|
|
|
|
|
what character will be used for padding the results to the
|
|
|
|
|
right string size. This may be a space character or a
|
|
|
|
|
<literal>0</literal> (zero character). The default is to pad
|
|
|
|
|
with spaces. An alternate padding character can be specified
|
|
|
|
|
by prefixing it with a single quote (<literal>'</literal>).
|
1999-10-20 22:41:42 +00:00
|
|
|
|
See the examples below.</simpara></listitem>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<listitem>
|
|
|
|
|
<simpara>
|
|
|
|
|
An optional <emphasis>alignment specifier</emphasis> that says
|
|
|
|
|
if the result should be left-justified or right-justified.
|
|
|
|
|
The default is right-justified; a <literal>-</literal>
|
1999-10-20 22:41:42 +00:00
|
|
|
|
character here will make it left-justified.</simpara></listitem>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<listitem>
|
|
|
|
|
<simpara>
|
|
|
|
|
An optional number, a <emphasis>width specifier</emphasis>
|
|
|
|
|
that says how many characters (minimum) this conversion should
|
1999-10-20 22:41:42 +00:00
|
|
|
|
result in.</simpara></listitem>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<listitem>
|
|
|
|
|
<simpara>
|
|
|
|
|
An optional <emphasis>precision specifier</emphasis> that says
|
|
|
|
|
how many decimal digits should be displayed for floating-point
|
|
|
|
|
numbers. This option has no effect for other types than
|
|
|
|
|
double. (Another function useful for formatting numbers is
|
1999-10-20 22:41:42 +00:00
|
|
|
|
<function>number_format</function>.)</simpara></listitem>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<listitem>
|
|
|
|
|
<para>
|
|
|
|
|
A <emphasis>type specifier</emphasis> that says what type the
|
|
|
|
|
argument data should be treated as. Possible types:
|
|
|
|
|
|
|
|
|
|
<simplelist>
|
|
|
|
|
<member>
|
|
|
|
|
<literal>%</literal> - a literal percent character. No
|
|
|
|
|
argument is required.
|
|
|
|
|
</member>
|
|
|
|
|
<member>
|
|
|
|
|
<literal>b</literal> - the argument is treated as an
|
|
|
|
|
integer, and presented as a binary number.
|
|
|
|
|
</member>
|
|
|
|
|
<member>
|
|
|
|
|
<literal>c</literal> - the argument is treated as an
|
|
|
|
|
integer, and presented as the character with that ASCII
|
|
|
|
|
value.
|
|
|
|
|
</member>
|
|
|
|
|
<member>
|
|
|
|
|
<literal>d</literal> - the argument is treated as an
|
|
|
|
|
integer, and presented as a decimal number.
|
|
|
|
|
</member>
|
|
|
|
|
<member>
|
|
|
|
|
<literal>f</literal> - the argument is treated as a double,
|
|
|
|
|
and presented as a floating-point number.
|
|
|
|
|
</member>
|
|
|
|
|
<member>
|
|
|
|
|
<literal>o</literal> - the argument is treated as an
|
|
|
|
|
integer, and presented as an octal number.
|
|
|
|
|
</member>
|
|
|
|
|
<member>
|
|
|
|
|
<literal>s</literal> - the argument is treated as and
|
|
|
|
|
presented as a string.
|
|
|
|
|
</member>
|
|
|
|
|
<member>
|
|
|
|
|
<literal>x</literal> - the argument is treated as an integer
|
|
|
|
|
and presented as a hexadecimal number (with lowercase
|
|
|
|
|
letters).
|
|
|
|
|
</member>
|
|
|
|
|
<member>
|
|
|
|
|
<literal>X</literal> - the argument is treated as an integer
|
|
|
|
|
and presented as a hexadecimal number (with uppercase
|
|
|
|
|
letters).
|
|
|
|
|
</member>
|
1999-10-20 22:41:42 +00:00
|
|
|
|
</simplelist></para></listitem>
|
|
|
|
|
</orderedlist></para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
|
|
|
|
|
<simpara>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
See also: <function>printf</function> and
|
1999-10-20 22:41:42 +00:00
|
|
|
|
<function>number_format</function>.</simpara>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
|
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
|
|
<refsect1>
|
|
|
|
|
<title>Examples</title>
|
|
|
|
|
<para>
|
|
|
|
|
<example>
|
|
|
|
|
<title>sprintf: zero-padded integers</title>
|
|
|
|
|
<programlisting>
|
|
|
|
|
$isodate = sprintf("%04d-%02d-%02d", $year, $month, $day);
|
|
|
|
|
</programlisting></example>
|
|
|
|
|
|
|
|
|
|
<example>
|
|
|
|
|
<title>sprintf: formatting currency</title>
|
|
|
|
|
<programlisting>
|
|
|
|
|
$money1 = 68.75;
|
|
|
|
|
$money2 = 54.35;
|
|
|
|
|
$money = $money1 + $money2;
|
|
|
|
|
// echo $money will output "123.1";
|
|
|
|
|
$formatted = sprintf ("%01.2f", $money);
|
|
|
|
|
// echo $formatted will output "123.10"
|
|
|
|
|
</programlisting></example>
|
|
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
</refsect1>
|
|
|
|
|
</refentry>
|
|
|
|
|
|
1999-09-02 14:09:16 +00:00
|
|
|
|
<refentry id="function.strcasecmp">
|
|
|
|
|
<refnamediv>
|
|
|
|
|
<refname>strcasecmp</refname>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<refpurpose>
|
|
|
|
|
Binary safe case-insensitive string comparison
|
|
|
|
|
</refpurpose>
|
1999-09-02 14:09:16 +00:00
|
|
|
|
</refnamediv>
|
|
|
|
|
<refsect1>
|
|
|
|
|
<title>Description</title>
|
|
|
|
|
<funcsynopsis>
|
|
|
|
|
<funcdef>int <function>strcasecmp</function></funcdef>
|
|
|
|
|
<paramdef>string <parameter>str1</parameter></paramdef>
|
|
|
|
|
<paramdef>string <parameter>str2</parameter></paramdef>
|
|
|
|
|
</funcsynopsis>
|
|
|
|
|
<simpara>
|
|
|
|
|
Returns < 0 if <parameter>str1</parameter> is less than
|
|
|
|
|
<parameter>str2</parameter>; > 0 if <parameter>str1</parameter>
|
|
|
|
|
is greater than <parameter>str2</parameter>, and 0 if they are
|
1999-10-20 22:41:42 +00:00
|
|
|
|
equal.</simpara>
|
1999-09-02 14:09:16 +00:00
|
|
|
|
|
|
|
|
|
<simpara>
|
|
|
|
|
See also <function>ereg</function>, <function>strcmp</function>,
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<function>substr</function>, <function>stristr</function>, and
|
1999-10-20 22:41:42 +00:00
|
|
|
|
<function>strstr</function>.</simpara>
|
1999-09-02 14:09:16 +00:00
|
|
|
|
|
|
|
|
|
</refsect1>
|
|
|
|
|
</refentry>
|
|
|
|
|
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<refentry id="function.strchr">
|
|
|
|
|
<refnamediv>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<refname>strchr</refname>
|
|
|
|
|
<refpurpose>
|
|
|
|
|
Find the first occurrence of a character.
|
|
|
|
|
</refpurpose>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</refnamediv>
|
|
|
|
|
<refsect1>
|
|
|
|
|
<title>Description</title>
|
|
|
|
|
<funcsynopsis>
|
|
|
|
|
<funcdef>string <function>strchr</function></funcdef>
|
|
|
|
|
<paramdef>string <parameter>haystack</parameter></paramdef>
|
|
|
|
|
<paramdef>string <parameter>needle</parameter></paramdef>
|
|
|
|
|
</funcsynopsis>
|
|
|
|
|
|
|
|
|
|
<para>
|
|
|
|
|
This function is an alias for <function>strstr</function>, and is
|
1999-10-20 22:41:42 +00:00
|
|
|
|
identical in every way.</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
|
|
|
|
|
</refsect1>
|
|
|
|
|
</refentry>
|
|
|
|
|
|
|
|
|
|
<refentry id="function.strcmp">
|
|
|
|
|
<refnamediv>
|
|
|
|
|
<refname>strcmp</refname>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<refpurpose>Binary safe string comparison</refpurpose>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</refnamediv>
|
|
|
|
|
<refsect1>
|
|
|
|
|
<title>Description</title>
|
|
|
|
|
<funcsynopsis>
|
|
|
|
|
<funcdef>int <function>strcmp</function></funcdef>
|
|
|
|
|
<paramdef>string <parameter>str1</parameter></paramdef>
|
|
|
|
|
<paramdef>string <parameter>str2</parameter></paramdef>
|
|
|
|
|
</funcsynopsis>
|
|
|
|
|
<simpara>
|
|
|
|
|
Returns < 0 if <parameter>str1</parameter> is less than
|
|
|
|
|
<parameter>str2</parameter>; > 0 if <parameter>str1</parameter>
|
|
|
|
|
is greater than <parameter>str2</parameter>, and 0 if they are
|
1999-10-20 22:41:42 +00:00
|
|
|
|
equal.</simpara>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
|
|
|
|
|
<simpara>
|
1999-10-20 22:41:42 +00:00
|
|
|
|
Note that this comparison is case sensitive.</simpara>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
|
|
|
|
|
<simpara>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
See also <function>ereg</function>,
|
|
|
|
|
<function>strcasecmp</function>, <function>substr</function>,
|
1999-10-20 22:41:42 +00:00
|
|
|
|
<function>stristr</function>, and <function>strstr</function>.</simpara>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
|
|
|
|
|
</refsect1>
|
|
|
|
|
</refentry>
|
|
|
|
|
|
|
|
|
|
<refentry id="function.strcspn">
|
|
|
|
|
<refnamediv>
|
|
|
|
|
<refname>strcspn</refname>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<refpurpose>
|
|
|
|
|
Find length of initial segment not matching mask
|
|
|
|
|
</refpurpose>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</refnamediv>
|
|
|
|
|
<refsect1>
|
|
|
|
|
<title>Description</title>
|
|
|
|
|
<funcsynopsis>
|
|
|
|
|
<funcdef>int <function>strcspn</function></funcdef>
|
|
|
|
|
<paramdef>string <parameter>str1</parameter></paramdef>
|
|
|
|
|
<paramdef>string <parameter>str2</parameter></paramdef>
|
|
|
|
|
</funcsynopsis>
|
|
|
|
|
<simpara>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
Returns the length of the initial segment of
|
|
|
|
|
<parameter>str1</parameter> which does <emphasis>not</emphasis>
|
1999-10-20 22:41:42 +00:00
|
|
|
|
contain any of the characters in <parameter>str2</parameter>.</simpara>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
|
|
|
|
|
<simpara>
|
1999-10-20 22:41:42 +00:00
|
|
|
|
See also <function>strspn</function>.</simpara>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
|
|
|
|
|
</refsect1>
|
|
|
|
|
</refentry>
|
|
|
|
|
|
|
|
|
|
<refentry id="function.strip-tags">
|
|
|
|
|
<refnamediv>
|
|
|
|
|
<refname>strip_tags</refname>
|
|
|
|
|
<refpurpose>Strip HTML and PHP tags from a string</refpurpose>
|
|
|
|
|
</refnamediv>
|
|
|
|
|
<refsect1>
|
|
|
|
|
<title>Description</title>
|
|
|
|
|
<funcsynopsis>
|
|
|
|
|
<funcdef>string <function>strip_tags</function></funcdef>
|
|
|
|
|
<paramdef>string <parameter>str</parameter></paramdef>
|
1999-09-23 08:49:02 +00:00
|
|
|
|
<paramdef>string <parameter><optional>allowable_tags</optional></parameter></paramdef>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</funcsynopsis>
|
1999-09-23 08:49:02 +00:00
|
|
|
|
<para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
This function tries to strip all HTML and PHP tags from the given
|
|
|
|
|
string. It errors on the side of caution in case of incomplete
|
|
|
|
|
or bogus tags. It uses the same tag stripping state machine as
|
1999-10-20 22:41:42 +00:00
|
|
|
|
the <function>fgetss</function> function.</para>
|
1999-09-23 08:49:02 +00:00
|
|
|
|
<para>
|
|
|
|
|
You can use the optional second parameter to specify tags which
|
|
|
|
|
should not be stripped.
|
|
|
|
|
|
|
|
|
|
<note>
|
|
|
|
|
<para>
|
1999-10-20 22:41:42 +00:00
|
|
|
|
<parameter>allowable_tags</parameter> was added in PHP 3.0.13, PHP4B3.</para>
|
|
|
|
|
</note></para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</refsect1>
|
|
|
|
|
</refentry>
|
|
|
|
|
|
1999-09-06 00:24:06 +00:00
|
|
|
|
<refentry id="function.stripcslashes">
|
|
|
|
|
<refnamediv>
|
|
|
|
|
<refname>StripCSlashes</refname>
|
|
|
|
|
<refpurpose>un-quote string quoted with addcslashes</refpurpose>
|
|
|
|
|
</refnamediv>
|
|
|
|
|
<refsect1>
|
|
|
|
|
<title>Description</title>
|
|
|
|
|
<funcsynopsis>
|
|
|
|
|
<funcdef>string <function>stripcslashes</function></funcdef>
|
|
|
|
|
<paramdef>string <parameter>str</parameter></paramdef>
|
|
|
|
|
</funcsynopsis>
|
|
|
|
|
<para>
|
|
|
|
|
Returns a string with backslashes stripped off. Recognizes
|
|
|
|
|
C-like <literal>\n</literal>, <literal>\r</literal> ..., octal
|
|
|
|
|
and hexadecimal representation.
|
|
|
|
|
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<note>
|
|
|
|
|
<simpara>
|
1999-10-20 22:41:42 +00:00
|
|
|
|
Added in PHP4b3-dev.</simpara>
|
|
|
|
|
</note></para>
|
1999-09-06 00:24:06 +00:00
|
|
|
|
<simpara>
|
1999-10-20 22:41:42 +00:00
|
|
|
|
See also <function>addcslashes</function>.</simpara>
|
1999-09-06 00:24:06 +00:00
|
|
|
|
|
|
|
|
|
</refsect1>
|
|
|
|
|
</refentry>
|
|
|
|
|
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<refentry id="function.stripslashes">
|
|
|
|
|
<refnamediv>
|
|
|
|
|
<refname>StripSlashes</refname>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<refpurpose>Un-quote string quoted with addslashes</refpurpose>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</refnamediv>
|
|
|
|
|
<refsect1>
|
|
|
|
|
<title>Description</title>
|
|
|
|
|
<funcsynopsis>
|
|
|
|
|
<funcdef>string <function>stripslashes</function></funcdef>
|
|
|
|
|
<paramdef>string <parameter>str</parameter></paramdef>
|
|
|
|
|
</funcsynopsis>
|
|
|
|
|
<para>
|
|
|
|
|
Returns a string with backslashes stripped off.
|
|
|
|
|
(<literal>\'</literal> becomes <literal>'</literal> and so on.)
|
1999-10-20 22:41:42 +00:00
|
|
|
|
Double backslashes are made into a single backslash.</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
|
|
|
|
|
<simpara>
|
1999-10-20 22:41:42 +00:00
|
|
|
|
See also <function>addslashes</function>.</simpara>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
|
|
|
|
|
</refsect1>
|
|
|
|
|
</refentry>
|
|
|
|
|
|
1999-09-06 03:40:25 +00:00
|
|
|
|
<refentry id="function.stristr">
|
|
|
|
|
<refnamediv>
|
|
|
|
|
<refname>stristr</refname>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<refpurpose>
|
|
|
|
|
Case-insensitive <function>strstr</function>
|
|
|
|
|
</refpurpose>
|
1999-09-06 03:40:25 +00:00
|
|
|
|
</refnamediv>
|
|
|
|
|
<refsect1>
|
|
|
|
|
<title>Description</title>
|
|
|
|
|
<funcsynopsis>
|
|
|
|
|
<funcdef>string <function>stristr</function></funcdef>
|
|
|
|
|
<paramdef>string <parameter>haystack</parameter></paramdef>
|
|
|
|
|
<paramdef>string <parameter>needle</parameter></paramdef>
|
|
|
|
|
</funcsynopsis>
|
|
|
|
|
<para>
|
|
|
|
|
Returns all of <parameter>haystack</parameter> from the first
|
|
|
|
|
occurrence of <parameter>needle</parameter> to the end.
|
|
|
|
|
<parameter>needle</parameter> and <parameter>haystack</parameter>
|
1999-10-20 22:41:42 +00:00
|
|
|
|
are examined in a case-insensitive manner.</para>
|
1999-09-06 03:40:25 +00:00
|
|
|
|
<para>
|
1999-10-20 22:41:42 +00:00
|
|
|
|
If <parameter>needle</parameter> is not found, returns false.</para>
|
1999-09-06 03:40:25 +00:00
|
|
|
|
<para>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
If <parameter>needle</parameter> is not a string, it is converted
|
1999-10-20 22:41:42 +00:00
|
|
|
|
to an integer and applied as the ordinal value of a character.</para>
|
1999-09-06 03:40:25 +00:00
|
|
|
|
<para>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
See also <function>strchr</function>,
|
|
|
|
|
<function>strrchr</function>, <function>substr</function>, and
|
1999-10-20 22:41:42 +00:00
|
|
|
|
<function>ereg</function>.</para>
|
1999-09-06 03:40:25 +00:00
|
|
|
|
</refsect1>
|
|
|
|
|
</refentry>
|
|
|
|
|
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<refentry id="function.strlen">
|
|
|
|
|
<refnamediv>
|
|
|
|
|
<refname>strlen</refname>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<refpurpose>Get string length</refpurpose>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</refnamediv>
|
|
|
|
|
<refsect1>
|
|
|
|
|
<title>Description</title>
|
|
|
|
|
<funcsynopsis>
|
|
|
|
|
<funcdef>int <function>strlen</function></funcdef>
|
|
|
|
|
<paramdef>string <parameter>str</parameter></paramdef>
|
|
|
|
|
</funcsynopsis>
|
|
|
|
|
<para>
|
1999-10-20 22:41:42 +00:00
|
|
|
|
Returns the length of <parameter>string</parameter>.</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</refsect1>
|
|
|
|
|
</refentry>
|
|
|
|
|
|
|
|
|
|
<refentry id="function.strpos">
|
|
|
|
|
<refnamediv>
|
|
|
|
|
<refname>strpos</refname>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<refpurpose>
|
|
|
|
|
Find position of first occurrence of a string
|
|
|
|
|
</refpurpose>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</refnamediv>
|
|
|
|
|
<refsect1>
|
|
|
|
|
<title>Description</title>
|
|
|
|
|
<funcsynopsis>
|
|
|
|
|
<funcdef>int <function>strpos</function></funcdef>
|
|
|
|
|
<paramdef>string <parameter>haystack</parameter></paramdef>
|
|
|
|
|
<paramdef>string <parameter>needle</parameter></paramdef>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<paramdef>int
|
|
|
|
|
<parameter><optional>offset</optional></parameter>
|
|
|
|
|
</paramdef>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</funcsynopsis>
|
|
|
|
|
<para>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
Returns the numeric position of the first occurrence of
|
|
|
|
|
<parameter>needle</parameter> in the
|
|
|
|
|
<parameter>haystack</parameter> string. Unlike the
|
|
|
|
|
<function>strrpos</function>, this function can take a full
|
|
|
|
|
string as the <parameter>needle</parameter> parameter and the
|
1999-10-20 22:41:42 +00:00
|
|
|
|
entire string will be used.</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<para>
|
1999-10-20 22:41:42 +00:00
|
|
|
|
If <parameter>needle</parameter> is not found, returns false.</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<para>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
If <parameter>needle</parameter> is not a string, it is converted
|
1999-10-20 22:41:42 +00:00
|
|
|
|
to an integer and applied as the ordinal value of a character.</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<para>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
The optional <parameter>offset</parameter> parameter allows you
|
|
|
|
|
to specify which character in <parameter>haystack</parameter> to
|
|
|
|
|
start searching. The position returned is still relative to the
|
1999-10-20 22:41:42 +00:00
|
|
|
|
the beginning of <parameter>haystack</parameter>.</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<para>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
See also <function>strrpos</function>,
|
|
|
|
|
<function>strrchr</function>, <function>substr</function>,
|
1999-10-20 22:41:42 +00:00
|
|
|
|
<function>stristr</function>, and <function>strstr</function>.</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</refsect1>
|
|
|
|
|
</refentry>
|
|
|
|
|
|
|
|
|
|
<refentry id="function.strrchr">
|
|
|
|
|
<refnamediv>
|
|
|
|
|
<refname>strrchr</refname>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<refpurpose>
|
|
|
|
|
Find the last occurrence of a character in a string
|
|
|
|
|
</refpurpose>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</refnamediv>
|
|
|
|
|
<refsect1>
|
|
|
|
|
<title>Description</title>
|
|
|
|
|
<funcsynopsis>
|
|
|
|
|
<funcdef>string <function>strrchr</function></funcdef>
|
|
|
|
|
<paramdef>string <parameter>haystack</parameter></paramdef>
|
|
|
|
|
<paramdef>string <parameter>needle</parameter></paramdef>
|
|
|
|
|
</funcsynopsis>
|
|
|
|
|
<para>
|
|
|
|
|
This function returns the portion of
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<parameter>haystack</parameter> which starts at the last
|
|
|
|
|
occurrence of <parameter>needle</parameter> and goes until the
|
1999-10-20 22:41:42 +00:00
|
|
|
|
end of <parameter>haystack</parameter>.</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<para>
|
1999-10-20 22:41:42 +00:00
|
|
|
|
Returns false if <parameter>needle</parameter> is not found.</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<para>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
If <parameter>needle</parameter> contains more than one
|
1999-10-20 22:41:42 +00:00
|
|
|
|
character, the first is used.</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<para>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
If <parameter>needle</parameter> is not a string, it is converted
|
|
|
|
|
to an integer and applied as the ordinal value of a character.
|
1999-06-06 18:51:02 +00:00
|
|
|
|
|
|
|
|
|
<example>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<title><function>strrchr</function> example</title>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<programlisting>
|
|
|
|
|
// get last directory in $PATH
|
|
|
|
|
$dir = substr( strrchr( $PATH, ":" ), 1 );
|
|
|
|
|
|
|
|
|
|
// get everything after last newline
|
|
|
|
|
$text = "Line 1\nLine 2\nLine 3";
|
|
|
|
|
$last = substr( strrchr( $text, 10 ), 1 );
|
|
|
|
|
</programlisting>
|
1999-10-20 22:41:42 +00:00
|
|
|
|
</example></para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
|
|
|
|
|
<para>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
See also <function>substr</function>,
|
1999-10-20 22:41:42 +00:00
|
|
|
|
<function>stristr</function>, and <function>strstr</function>.</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
|
|
|
|
|
</refsect1>
|
|
|
|
|
</refentry>
|
|
|
|
|
|
1999-10-28 17:26:31 +00:00
|
|
|
|
<refentry id="function.str-repeat">
|
1999-10-28 16:58:56 +00:00
|
|
|
|
<refnamediv>
|
|
|
|
|
<refname>str_repeat</refname>
|
|
|
|
|
<refpurpose>Repeat a string</refpurpose>
|
|
|
|
|
</refnamediv>
|
|
|
|
|
<refsect1>
|
|
|
|
|
<title>Description</title>
|
|
|
|
|
<funcsynopsis>
|
|
|
|
|
<funcdef>string <function>str_repeat</function></funcdef>
|
|
|
|
|
<paramdef>string <parameter>input</parameter></paramdef>
|
|
|
|
|
<paramdef>int <parameter>multiplier</parameter></paramdef>
|
|
|
|
|
</funcsynopsis>
|
|
|
|
|
<para>
|
|
|
|
|
Returns <parameter>input_str</parameter> repeated
|
|
|
|
|
<parameter>multiplier</parameter> times.
|
|
|
|
|
<parameter>multiplier</parameter> has to be greater than 0.
|
1999-10-28 17:26:31 +00:00
|
|
|
|
</para>
|
|
|
|
|
<example>
|
|
|
|
|
<title><function>str_repeat</function> example</title>
|
|
|
|
|
<programlisting>
|
1999-10-28 16:58:56 +00:00
|
|
|
|
echo str_repeat("-=", 10);
|
1999-10-28 17:26:31 +00:00
|
|
|
|
</programlisting>
|
|
|
|
|
</example>
|
|
|
|
|
<para>
|
|
|
|
|
This will output "-=-=-=-=-=-=-=-=-=-=".
|
1999-10-28 16:58:56 +00:00
|
|
|
|
</para>
|
1999-11-02 14:58:47 +00:00
|
|
|
|
|
|
|
|
|
<note>
|
|
|
|
|
<para>
|
|
|
|
|
This function was added in PHP 4.0.</para>
|
|
|
|
|
</note>
|
1999-10-28 16:58:56 +00:00
|
|
|
|
</refsect1>
|
|
|
|
|
</refentry>
|
|
|
|
|
|
|
|
|
|
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<refentry id="function.strrev">
|
|
|
|
|
<refnamediv>
|
|
|
|
|
<refname>strrev</refname>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<refpurpose>Reverse a string</refpurpose>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</refnamediv>
|
|
|
|
|
<refsect1>
|
|
|
|
|
<title>Description</title>
|
|
|
|
|
<funcsynopsis>
|
|
|
|
|
<funcdef>string <function>strrev</function></funcdef>
|
|
|
|
|
<paramdef>string <parameter>string</parameter></paramdef>
|
|
|
|
|
</funcsynopsis>
|
|
|
|
|
<para>
|
1999-10-20 22:41:42 +00:00
|
|
|
|
Returns <parameter>string</parameter>, reversed.</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</refsect1>
|
|
|
|
|
</refentry>
|
|
|
|
|
|
1999-09-05 23:11:23 +00:00
|
|
|
|
<refentry id="function.strrpos">
|
|
|
|
|
<refnamediv>
|
|
|
|
|
<refname>strrpos</refname>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<refpurpose>
|
|
|
|
|
Find position of last occurrence of a char in a string
|
|
|
|
|
</refpurpose>
|
1999-09-05 23:11:23 +00:00
|
|
|
|
</refnamediv>
|
|
|
|
|
<refsect1>
|
|
|
|
|
<title>Description</title>
|
|
|
|
|
<funcsynopsis>
|
|
|
|
|
<funcdef>int <function>strrpos</function></funcdef>
|
|
|
|
|
<paramdef>string <parameter>haystack</parameter></paramdef>
|
|
|
|
|
<paramdef>char <parameter>needle</parameter></paramdef>
|
|
|
|
|
</funcsynopsis>
|
|
|
|
|
<para>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
Returns the numeric position of the last occurrence of
|
|
|
|
|
<parameter>needle</parameter> in the
|
|
|
|
|
<parameter>haystack</parameter> string. Note that the needle in
|
|
|
|
|
this case can only be a single character. If a string is passed
|
|
|
|
|
as the needle, then only the first character of that string will
|
1999-10-20 22:41:42 +00:00
|
|
|
|
be used.</para>
|
1999-09-05 23:11:23 +00:00
|
|
|
|
<para>
|
1999-10-20 22:41:42 +00:00
|
|
|
|
If <parameter>needle</parameter> is not found, returns false.</para>
|
1999-09-05 23:11:23 +00:00
|
|
|
|
<para>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
If <parameter>needle</parameter> is not a string, it is converted
|
1999-10-20 22:41:42 +00:00
|
|
|
|
to an integer and applied as the ordinal value of a character.</para>
|
1999-09-05 23:11:23 +00:00
|
|
|
|
<para>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
See also <function>strpos</function>,
|
|
|
|
|
<function>strrchr</function>, <function>substr</function>,
|
1999-10-20 22:41:42 +00:00
|
|
|
|
<function>stristr</function>, and <function>strstr</function>.</para>
|
1999-09-05 23:11:23 +00:00
|
|
|
|
</refsect1>
|
|
|
|
|
</refentry>
|
|
|
|
|
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<refentry id="function.strspn">
|
|
|
|
|
<refnamediv>
|
|
|
|
|
<refname>strspn</refname>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<refpurpose>
|
|
|
|
|
Find length of initial segment matching mask
|
|
|
|
|
</refpurpose>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</refnamediv>
|
|
|
|
|
<refsect1>
|
|
|
|
|
<title>Description</title>
|
|
|
|
|
<funcsynopsis>
|
|
|
|
|
<funcdef>int <function>strspn</function></funcdef>
|
|
|
|
|
<paramdef>string <parameter>str1</parameter></paramdef>
|
|
|
|
|
<paramdef>string <parameter>str2</parameter></paramdef>
|
|
|
|
|
</funcsynopsis>
|
|
|
|
|
<simpara>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
Returns the length of the initial segment of
|
|
|
|
|
<parameter>str1</parameter> which consists entirely of characters
|
1999-10-20 22:41:42 +00:00
|
|
|
|
in <parameter>str2</parameter>.</simpara>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<simpara>
|
1999-10-20 22:41:42 +00:00
|
|
|
|
See also <function>strcspn</function>.</simpara>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
</refsect1>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</refentry>
|
|
|
|
|
|
|
|
|
|
<refentry id="function.strstr">
|
|
|
|
|
<refnamediv>
|
|
|
|
|
<refname>strstr</refname>
|
|
|
|
|
<refpurpose>Find first occurrence of a string.</refpurpose>
|
|
|
|
|
</refnamediv>
|
|
|
|
|
<refsect1>
|
|
|
|
|
<title>Description</title>
|
|
|
|
|
<funcsynopsis>
|
|
|
|
|
<funcdef>string <function>strstr</function></funcdef>
|
|
|
|
|
<paramdef>string <parameter>haystack</parameter></paramdef>
|
|
|
|
|
<paramdef>string <parameter>needle</parameter></paramdef>
|
|
|
|
|
</funcsynopsis>
|
|
|
|
|
<para>
|
|
|
|
|
Returns all of <parameter>haystack</parameter> from the first
|
1999-10-20 22:41:42 +00:00
|
|
|
|
occurrence of <parameter>needle</parameter> to the end.</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<para>
|
1999-10-20 22:41:42 +00:00
|
|
|
|
If <parameter>needle</parameter> is not found, returns false.</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<para>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
If <parameter>needle</parameter> is not a string, it is converted
|
1999-10-20 22:41:42 +00:00
|
|
|
|
to an integer and applied as the ordinal value of a character.</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<para>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
See also <function>stristr</function>,
|
|
|
|
|
<function>strrchr</function>, <function>substr</function>, and
|
1999-10-20 22:41:42 +00:00
|
|
|
|
<function>ereg</function>.</para>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
</refsect1>
|
|
|
|
|
</refentry>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
|
|
|
|
|
<refentry id="function.strtok">
|
|
|
|
|
<refnamediv>
|
|
|
|
|
<refname>strtok</refname>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<refpurpose>Tokenize string</refpurpose>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</refnamediv>
|
|
|
|
|
<refsect1>
|
|
|
|
|
<title>Description</title>
|
|
|
|
|
<funcsynopsis>
|
|
|
|
|
<funcdef>string <function>strtok</function></funcdef>
|
|
|
|
|
<paramdef>string <parameter>arg1</parameter></paramdef>
|
|
|
|
|
<paramdef>string <parameter>arg2</parameter></paramdef>
|
|
|
|
|
</funcsynopsis>
|
|
|
|
|
<para>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<function>strtok</function> is used to tokenize a string. That
|
|
|
|
|
is, if you have a string like "This is an example string" you
|
|
|
|
|
could tokenize this string into its individual words by using the
|
|
|
|
|
space character as the token.
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<example>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<title><function>strtok</function> example</title>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<programlisting>
|
|
|
|
|
$string = "This is an example string";
|
|
|
|
|
$tok = strtok($string," ");
|
|
|
|
|
while($tok) {
|
|
|
|
|
echo "Word=$tok<br>";
|
|
|
|
|
$tok = strtok(" ");
|
|
|
|
|
}
|
1999-09-13 18:07:16 +00:00
|
|
|
|
</programlisting>
|
1999-10-20 22:41:42 +00:00
|
|
|
|
</example></para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<para>
|
|
|
|
|
Note that only the first call to strtok uses the string argument.
|
|
|
|
|
Every subsequent call to strtok only needs the token to use, as
|
|
|
|
|
it keeps track of where it is in the current string. To start
|
|
|
|
|
over, or to tokenize a new string you simply call strtok with the
|
|
|
|
|
string argument again to initialize it. Note that you may put
|
|
|
|
|
multiple tokens in the token parameter. The string will be
|
|
|
|
|
tokenized when any one of the characters in the argument are
|
1999-10-20 22:41:42 +00:00
|
|
|
|
found.</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<para>
|
|
|
|
|
Also be careful that your tokens may be equal to "0". This
|
1999-10-20 22:41:42 +00:00
|
|
|
|
evaluates to false in conditional expressions.</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<para>
|
|
|
|
|
See also <function>split</function> and
|
1999-10-20 22:41:42 +00:00
|
|
|
|
<function>explode</function>.</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</refsect1>
|
|
|
|
|
</refentry>
|
|
|
|
|
|
|
|
|
|
<refentry id="function.strtolower">
|
|
|
|
|
<refnamediv>
|
|
|
|
|
<refname>strtolower</refname>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<refpurpose>Make a string lowercase</refpurpose>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</refnamediv>
|
|
|
|
|
<refsect1>
|
|
|
|
|
<title>Description</title>
|
|
|
|
|
<funcsynopsis>
|
|
|
|
|
<funcdef>string <function>strtolower</function></funcdef>
|
|
|
|
|
<paramdef>string <parameter>str</parameter></paramdef>
|
|
|
|
|
</funcsynopsis>
|
|
|
|
|
<para>
|
|
|
|
|
Returns <parameter>string</parameter> with all alphabetic
|
1999-10-20 22:41:42 +00:00
|
|
|
|
characters converted to lowercase.</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<para>
|
|
|
|
|
Note that 'alphabetic' is determined by the current locale. This
|
|
|
|
|
means that in i.e. the default "C" locale, characters such as
|
1999-10-20 22:41:42 +00:00
|
|
|
|
umlaut-A (<28>) will not be converted.</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<para>
|
|
|
|
|
See also <function>strtoupper</function>
|
1999-10-20 22:41:42 +00:00
|
|
|
|
and <function>ucfirst</function>.</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
|
|
|
|
|
</refsect1>
|
|
|
|
|
</refentry>
|
|
|
|
|
|
|
|
|
|
<refentry id="function.strtoupper">
|
|
|
|
|
<refnamediv>
|
|
|
|
|
<refname>strtoupper</refname>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<refpurpose>Make a string uppercase</refpurpose>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</refnamediv>
|
|
|
|
|
<refsect1>
|
|
|
|
|
<title>Description</title>
|
|
|
|
|
<funcsynopsis>
|
|
|
|
|
<funcdef>string <function>strtoupper</function></funcdef>
|
|
|
|
|
<paramdef>string <parameter>string</parameter></paramdef>
|
|
|
|
|
</funcsynopsis>
|
|
|
|
|
<para>
|
|
|
|
|
Returns <parameter>string</parameter> with all alphabetic
|
1999-10-20 22:41:42 +00:00
|
|
|
|
characters converted to uppercase.</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<para>
|
|
|
|
|
Note that 'alphabetic' is determined by the current locale. For
|
|
|
|
|
instance, in the default "C" locale characters such as umlaut-a
|
1999-10-20 22:41:42 +00:00
|
|
|
|
(<28>) will not be converted.</para>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
See also <function>strtolower</function>
|
1999-10-20 22:41:42 +00:00
|
|
|
|
and <function>ucfirst</function>.</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</refsect1>
|
|
|
|
|
</refentry>
|
|
|
|
|
|
|
|
|
|
<refentry id="function.str-replace">
|
|
|
|
|
<refnamediv>
|
|
|
|
|
<refname>str_replace</refname>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<refpurpose>
|
|
|
|
|
Replace all occurrences of needle in haystack with str
|
|
|
|
|
</refpurpose>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</refnamediv>
|
|
|
|
|
<refsect1>
|
|
|
|
|
<title>Description</title>
|
|
|
|
|
<funcsynopsis>
|
|
|
|
|
<funcdef>string <function>str_replace</function></funcdef>
|
|
|
|
|
<paramdef>string <parameter>needle</parameter></paramdef>
|
|
|
|
|
<paramdef>string <parameter>str</parameter></paramdef>
|
|
|
|
|
<paramdef>string <parameter>haystack</parameter></paramdef>
|
|
|
|
|
</funcsynopsis>
|
|
|
|
|
<para>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
This function replaces all occurences of
|
|
|
|
|
<parameter>needle</parameter> in <parameter>haystack</parameter>
|
|
|
|
|
with the given <parameter>str</parameter>. If you don't need
|
|
|
|
|
fancy replacing rules, you should always use this function
|
1999-10-20 22:41:42 +00:00
|
|
|
|
instead of <function>ereg_replace</function>.</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<para>
|
|
|
|
|
<example>
|
|
|
|
|
<title>str_replace() example</title>
|
|
|
|
|
<programlisting>
|
|
|
|
|
$bodytag = str_replace("%body%", "black", "<body text=%body%>");
|
|
|
|
|
</programlisting>
|
1999-10-20 22:41:42 +00:00
|
|
|
|
</example></para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<para>
|
1999-10-20 22:41:42 +00:00
|
|
|
|
This function is binary safe.</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<para>
|
1999-10-20 22:41:42 +00:00
|
|
|
|
See also <function>ereg_replace</function>.</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</refsect1>
|
|
|
|
|
</refentry>
|
|
|
|
|
|
|
|
|
|
<refentry id="function.strtr">
|
|
|
|
|
<refnamediv>
|
|
|
|
|
<refname>strtr</refname>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<refpurpose>Translate certain characters</refpurpose>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</refnamediv>
|
|
|
|
|
<refsect1>
|
|
|
|
|
<title>Description</title>
|
|
|
|
|
<funcsynopsis>
|
|
|
|
|
<funcdef>string <function>strtr</function></funcdef>
|
|
|
|
|
<paramdef>string <parameter>str</parameter></paramdef>
|
|
|
|
|
<paramdef>string <parameter>from</parameter></paramdef>
|
|
|
|
|
<paramdef>string <parameter>to</parameter></paramdef>
|
|
|
|
|
</funcsynopsis>
|
|
|
|
|
<para>
|
|
|
|
|
This function operates on <parameter>str</parameter>, translating
|
|
|
|
|
all occurrences of each character in <parameter>from</parameter>
|
|
|
|
|
to the corresponding character in <parameter>to</parameter> and
|
1999-10-20 22:41:42 +00:00
|
|
|
|
returning the result.</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<para>
|
|
|
|
|
If <parameter>from</parameter> and <parameter>to</parameter> are
|
|
|
|
|
different lengths, the extra characters in the longer of the two
|
|
|
|
|
are ignored.
|
|
|
|
|
<example>
|
|
|
|
|
<title>strtr() example</title>
|
|
|
|
|
<programlisting>
|
|
|
|
|
$addr = strtr($addr, "<22><><EFBFBD>", "aao");
|
|
|
|
|
</programlisting>
|
1999-10-20 22:41:42 +00:00
|
|
|
|
</example></para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<para>
|
1999-10-20 22:41:42 +00:00
|
|
|
|
See also <function>ereg_replace</function>.</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</refsect1>
|
|
|
|
|
</refentry>
|
|
|
|
|
|
|
|
|
|
<refentry id="function.substr">
|
|
|
|
|
<refnamediv>
|
|
|
|
|
<refname>substr</refname>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<refpurpose>Return part of a string</refpurpose>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</refnamediv>
|
|
|
|
|
<refsect1>
|
|
|
|
|
<title>Description</title>
|
|
|
|
|
<funcsynopsis>
|
|
|
|
|
<funcdef>string <function>substr</function></funcdef>
|
|
|
|
|
<paramdef>string <parameter>string</parameter></paramdef>
|
|
|
|
|
<paramdef>int <parameter>start</parameter></paramdef>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<paramdef>int
|
|
|
|
|
<parameter><optional>length</optional></parameter>
|
|
|
|
|
</paramdef>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</funcsynopsis>
|
|
|
|
|
<para>
|
|
|
|
|
Substr returns the portion of <parameter>string</parameter>
|
|
|
|
|
specified by the <parameter>start</parameter> and
|
1999-10-20 22:41:42 +00:00
|
|
|
|
<parameter>length</parameter> parameters.</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<para>
|
|
|
|
|
If <parameter>start</parameter> is positive, the returned string
|
|
|
|
|
will start at the <parameter>start</parameter>'th character of
|
1999-10-20 22:41:42 +00:00
|
|
|
|
<parameter>string</parameter>.</para>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<para>
|
|
|
|
|
Examples:
|
|
|
|
|
<informalexample>
|
|
|
|
|
<programlisting role="php">
|
1999-06-06 18:51:02 +00:00
|
|
|
|
$rest = substr("abcdef", 1); // returns "bcdef"
|
|
|
|
|
$rest = substr("abcdef", 1, 3); // returns "bcd"
|
1999-09-13 18:07:16 +00:00
|
|
|
|
</programlisting>
|
1999-10-20 22:41:42 +00:00
|
|
|
|
</informalexample></para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<para>
|
|
|
|
|
If <parameter>start</parameter> is negative, the returned string
|
|
|
|
|
will start at the <parameter>start</parameter>'th character
|
1999-10-20 22:41:42 +00:00
|
|
|
|
from the end of <parameter>string</parameter>.</para>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<para>
|
|
|
|
|
Examples:
|
|
|
|
|
<informalexample>
|
|
|
|
|
<programlisting role="php">
|
1999-06-06 18:51:02 +00:00
|
|
|
|
$rest = substr("abcdef", -1); // returns "f"
|
|
|
|
|
$rest = substr("abcdef", -2); // returns "ef"
|
|
|
|
|
$rest = substr("abcdef", -3, 1); // returns "d"
|
1999-09-13 18:07:16 +00:00
|
|
|
|
</programlisting>
|
1999-10-20 22:41:42 +00:00
|
|
|
|
</informalexample></para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<para>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
If <parameter>length</parameter> is given and is positive, the
|
|
|
|
|
string returned will end <parameter>length</parameter> characters
|
|
|
|
|
from <parameter>start</parameter>. If this would result in a
|
|
|
|
|
string with negative length (because the start is past the end of
|
|
|
|
|
the string), then the returned string will contain the single
|
1999-10-20 22:41:42 +00:00
|
|
|
|
character at <parameter>start</parameter>.</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<para>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
If <parameter>length</parameter> is given and is negative, the
|
|
|
|
|
string returned will end <parameter>length</parameter> characters
|
|
|
|
|
from the end of <parameter>string</parameter>. If this would
|
1999-06-06 18:51:02 +00:00
|
|
|
|
result in a string with negative length, then the returned string
|
1999-09-13 18:07:16 +00:00
|
|
|
|
will contain the single character at
|
1999-10-20 22:41:42 +00:00
|
|
|
|
<parameter>start</parameter>.</para>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
Examples:
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<informalexample>
|
|
|
|
|
<programlisting role="php">
|
1999-06-06 18:51:02 +00:00
|
|
|
|
$rest = substr("abcdef", 1, -1); // returns "bcde"
|
1999-09-13 18:07:16 +00:00
|
|
|
|
</programlisting>
|
1999-10-20 22:41:42 +00:00
|
|
|
|
</informalexample></para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<para>
|
|
|
|
|
See also <function>strrchr</function> and
|
1999-10-20 22:41:42 +00:00
|
|
|
|
<function>ereg</function>.</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</refsect1>
|
|
|
|
|
</refentry>
|
|
|
|
|
|
|
|
|
|
<refentry id="function.trim">
|
|
|
|
|
<refnamediv>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<refname>trim</refname>
|
|
|
|
|
<refpurpose>
|
|
|
|
|
Strip whitespace from the beginning and end of a string
|
|
|
|
|
</refpurpose>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</refnamediv>
|
|
|
|
|
<refsect1>
|
|
|
|
|
<title>Description</title>
|
|
|
|
|
<funcsynopsis>
|
|
|
|
|
<funcdef>string <function>trim</function></funcdef>
|
|
|
|
|
<paramdef>string <parameter>str</parameter></paramdef>
|
|
|
|
|
</funcsynopsis>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<para>
|
|
|
|
|
This function strips whitespace from the start and the end of a
|
1999-10-20 22:41:42 +00:00
|
|
|
|
string and returns the stripped string.</para>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<para>
|
|
|
|
|
See also <function>chop</function> and
|
1999-10-20 22:41:42 +00:00
|
|
|
|
<function>ltrim</function>.</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</refsect1>
|
|
|
|
|
</refentry>
|
|
|
|
|
|
|
|
|
|
<refentry id="function.ucfirst">
|
|
|
|
|
<refnamediv>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<refname>ucfirst</refname>
|
|
|
|
|
<refpurpose>
|
|
|
|
|
Make a string's first character uppercase
|
|
|
|
|
</refpurpose>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</refnamediv>
|
|
|
|
|
<refsect1>
|
|
|
|
|
<title>Description</title>
|
|
|
|
|
<funcsynopsis>
|
|
|
|
|
<funcdef>string <function>ucfirst</function></funcdef>
|
|
|
|
|
<paramdef>string <parameter>str</parameter></paramdef>
|
|
|
|
|
</funcsynopsis>
|
|
|
|
|
<para>
|
|
|
|
|
Capitalizes the first character of <parameter>str</parameter> if
|
1999-10-20 22:41:42 +00:00
|
|
|
|
that character is alphabetic.</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<para>
|
|
|
|
|
Note that 'alphabetic' is determined by the current locale. For
|
|
|
|
|
instance, in the default "C" locale characters such as umlaut-a
|
1999-10-20 22:41:42 +00:00
|
|
|
|
(<28>) will not be converted.</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<para>
|
|
|
|
|
See also <function>strtoupper</function> and
|
1999-10-20 22:41:42 +00:00
|
|
|
|
<function>strtolower</function>.</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</refsect1>
|
|
|
|
|
</refentry>
|
|
|
|
|
|
|
|
|
|
<refentry id="function.ucwords">
|
|
|
|
|
<refnamediv>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
<refname>ucwords</refname>
|
|
|
|
|
<refpurpose>
|
|
|
|
|
Uppercase the first character of each word in a string
|
|
|
|
|
</refpurpose>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</refnamediv>
|
|
|
|
|
<refsect1>
|
|
|
|
|
<title>Description</title>
|
|
|
|
|
<funcsynopsis>
|
|
|
|
|
<funcdef>string <function>ucwords</function></funcdef>
|
|
|
|
|
<paramdef>string <parameter>str</parameter></paramdef>
|
|
|
|
|
</funcsynopsis>
|
|
|
|
|
<simpara>
|
1999-09-13 18:07:16 +00:00
|
|
|
|
Capitalizes the first character of each word in
|
1999-10-20 22:41:42 +00:00
|
|
|
|
<parameter>str</parameter> if that character is alphabetic.</simpara>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
<para>
|
|
|
|
|
See also <function>strtoupper</function>,
|
1999-10-20 22:41:42 +00:00
|
|
|
|
<function>strtolower</function> and <function>ucfirst</function>.</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
</refsect1>
|
|
|
|
|
</refentry>
|
|
|
|
|
|
|
|
|
|
</reference>
|
|
|
|
|
|
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
|
|
|
Local variables:
|
|
|
|
|
mode: sgml
|
|
|
|
|
sgml-omittag:t
|
|
|
|
|
sgml-shorttag:t
|
|
|
|
|
sgml-minimize-attributes:nil
|
|
|
|
|
sgml-always-quote-attributes:t
|
|
|
|
|
sgml-indent-step:1
|
|
|
|
|
sgml-indent-data:t
|
|
|
|
|
sgml-parent-document:nil
|
|
|
|
|
sgml-default-dtd-file:"../manual.ced"
|
|
|
|
|
sgml-exposed-tags:nil
|
|
|
|
|
sgml-local-catalogs:nil
|
|
|
|
|
sgml-local-ecat-files:nil
|
|
|
|
|
End:
|
|
|
|
|
-->
|