mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
Examples for ucfirst, ucwords and strcasecmp
Additions to trim and ltrim git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@19996 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
fe4b257662
commit
f9799e4dc0
1 changed files with 32 additions and 6 deletions
|
@ -765,7 +765,9 @@ $colon_separated = implode (":", $array);
|
|||
</funcsynopsis>
|
||||
<para>
|
||||
This function strips whitespace from the start of a string and
|
||||
returns the stripped string.
|
||||
returns the stripped string. The whitespace
|
||||
characters it currently strips are: "\n", "\r", "\t", "\v", "\0",
|
||||
and a plain space.
|
||||
</para>
|
||||
<para>
|
||||
See also <function>chop</function> and <function>trim</function>.
|
||||
|
@ -1373,12 +1375,22 @@ $formatted = sprintf ("%01.2f", $money);
|
|||
<paramdef>string <parameter>str1</parameter></paramdef>
|
||||
<paramdef>string <parameter>str2</parameter></paramdef>
|
||||
</funcsynopsis>
|
||||
<simpara>
|
||||
<para>
|
||||
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
|
||||
equal.
|
||||
</simpara>
|
||||
<example>
|
||||
<title><function>strcasecmp</function> example</title>
|
||||
<programlisting role="php">
|
||||
$var1 = "Hello";
|
||||
$var2 = "hello";
|
||||
if ( !strcasecmp($var1,$var2) ) {
|
||||
echo '$var1 is equal to $var2 in a case-insensitive string comparison';
|
||||
}
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
<simpara>
|
||||
See also <function>ereg</function>, <function>strcmp</function>,
|
||||
<function>substr</function>, <function>stristr</function>, and
|
||||
|
@ -2266,7 +2278,7 @@ echo substr_replace ($var, '', 10, -1) . "<br>\n";
|
|||
This function strips whitespace from the start and the end of a
|
||||
string and returns the stripped string. The whitespace
|
||||
characters it currently strips are: "\n", "\r", "\t", "\v", "\0",
|
||||
and " ".
|
||||
and a plain space.
|
||||
</para>
|
||||
<para>
|
||||
See also <function>chop</function> and
|
||||
|
@ -2296,6 +2308,13 @@ echo substr_replace ($var, '', 10, -1) . "<br>\n";
|
|||
Note that 'alphabetic' is determined by the current locale. For
|
||||
instance, in the default "C" locale characters such as umlaut-a
|
||||
(ä) will not be converted.
|
||||
<example>
|
||||
<title><function>ucfirst</function> example</title>
|
||||
<programlisting role="php">
|
||||
$text = 'mary had a little lamb and she loved it so.';
|
||||
$text = ucfirst($text); // $text is now Mary had a little lamb and she loved it so.
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
See also <function>strtoupper</function> and
|
||||
|
@ -2317,10 +2336,17 @@ echo substr_replace ($var, '', 10, -1) . "<br>\n";
|
|||
<funcdef>string <function>ucwords</function></funcdef>
|
||||
<paramdef>string <parameter>str</parameter></paramdef>
|
||||
</funcsynopsis>
|
||||
<simpara>
|
||||
<para>
|
||||
Capitalizes the first character of each word in
|
||||
<parameter>str</parameter> if that character is alphabetic.
|
||||
</simpara>
|
||||
<example>
|
||||
<title><function>ucwords</function> example</title>
|
||||
<programlisting role="php">
|
||||
$text = "mary had a little lamb and she loved it so.";
|
||||
$text = ucwords($text); // $text is now: Mary Had A Little Lamb And She Loved It So.
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
See also <function>strtoupper</function>,
|
||||
<function>strtolower</function> and <function>ucfirst</function>.
|
||||
|
|
Loading…
Reference in a new issue