<?php
str ucfirst ( str $str )
where,
$str = The string to transform the first character in UPPERCASE
?>
<?php
$str0010 = 'quandoque bonus dormitat Homerus';
$str0011 = ucfirst ($str0010);
echo 'Original STRING:<br>' . $str0010 .
'<br><br>After ucfirst:<br>' . $str0011 . '<br>';
?>
<?php
$str0020 = 'âmbito nacional';
$str0021 = ucfirst ($str0020);
echo 'Original STRING:<br>' . $str0020 .
'<br><br>After ucfirst:<br>' . $str0021 . '<br>';
?>
<?php
$str0030 = '1,2,3,4,5,6,7,8,9 for 12 missing 3';
$str0031 = ucfirst ($str0030);
echo 'Original STRING:<br>' . $str0030 .
'<br><br>After ucfirst:<br>' . $str0031 . '<br>';
?>
<?php
/* Make a string's first character uppercase */
echo "Basic and Various operations:<br><br>";
$str_array = array(
"TesTing lcfirst.",
"1.testing lcfirst",
"HELLO wORLD",
'HELLO wORLD',
"\0",
// Null
"\x00",
// Hex Null
"\x000",
"abcd",
// double quoted string
'xyz',
// single quoted string
"-3",
-3,
'-3.344',
-3.344,
NULL,
"NULL",
"0",
0,
TRUE,
// bool type
"TRUE",
"1",
1,
1.234444,
FALSE,
"FALSE",
" ",
" ",
'b',
// single char
'\t',
// escape sequences
"\t",
"12",
"12twelve",
// int + string
);
/* loop to test working of ucfirst
with different values */
foreach ($str_array as $string) {
echo $string . '<br>' . ucfirst($string) . '<br><br>';
}
?>