PHP/String/strtoupper
Содержание
Changing case of strings
<source lang="html4strict">
<? print strtoupper("i"m not yelling!"); print strtolower("<A HREF="one.php">one</A>"); ?>
</source>
Converting Case
<source lang="html4strict">
<?php $membership = "mz00xyz"; $membership = strtoupper( $membership );
print "$membership"; // prints "MZ00XYZ" ?> </source>
Modifying capitalize( ) to take a reference parameter
<source lang="html4strict">
<?php function capitalize( &$str, $each=TRUE ){ {
$str = strtolower($str); if ($each === true) { $str = ucwords($str); } else { $str{0} = strtoupper($str{0}); }
} $str = "hEllo WoRld!"; capitalize( $str ); echo $str; ?>
</source>
string strtoupper ( string str ) returns that string entirely in uppercase characters.
<source lang="html4strict">
<?
$string = "I like to program in PHP"; $a = strtoupper($string);
?>
</source>
strtoupper(): Convert a string to uppercase
<source lang="html4strict">
its syntax is: string strtoupper (string string) <? $sentence = "cooking"; $sentence = strtoupper($sentence); print $sentence; ?>
</source>
strtoupper.php
<source lang="html4strict">
<?php
$msg = "text."; echo strtoupper($msg);
?>
</source>
Using the word case functions
<source lang="html4strict">
<?php
$username="John Bond";
echo("$username in uppercase is ".strtoupper($username).".
");
echo("$username in lowercase is ".strtolower($username).".
");
echo("$username in first letter uppercase is ".ucwords($username).".
");
?>