|
We will look at some of the basic
string functions here first , we will
cover the changing of case of a string
or part of a string . Here are the
fuctions that we will cover.
strtolower() : This converts a string
to lower case
strtoupper() : This converts a string
to upper case
ucfirst() : This capitalizes the
first letter of a string as long as
it is alphabetic
ucwords() : This capitalizes the
first letter of each word in a string
that begins with an alphabetic letter
Lets look at an example that demonstartes
these functions.
<?php
$test_string = "This is our TEST
string";
echo $test_string . "<br>";
//test string
echo strtolower($test_string) . "<br>";
// convert to lower case
echo strtoupper($test_string) . "<br>";
//convert to upper case
echo ucfirst($test_string) . "<br>";
//first letter in string capitalized
echo ucwords($test_string) . "<br>";
//first letter in each word capitalized
?>
|