PHP/String/ucfirst

Материал из Web эксперт
Перейти к: навигация, поиск

Capitalizing letters

 
<?php
print ucfirst("how do you do today?");
print ucwords("the prince of wales");
?>



string ucfirst ( string str ) converts the first letter of the string to an uppercase character

 
<?
    $string = "i like to program in PHP";
    $a = strtoupper($string);
?>



ucfirst() function capitalizes the first letter of a string.

 
Its syntax is: string ucfirst (string string)
<?
$sentence = "cooking";
$sentence = ucfirst($sentence);
print $sentence;
?>



ucfirst.php

 
<?php
   $sentence = "the newest version";
   echo ucfirst($sentence);
?>