字串函式庫

ucfirst

(PHP3 , PHP4)

ucfirst ---  將字串的第一個字元大寫

語法 : string ucfirst (string str)

說明 : 

如果參數 str的第一個字元是字母,則將它轉成大寫的。

注意 : 字母字元是由目前場所來決定的,意思是說,例如在預設的 "C"場所時,像是曲音A就不會被轉換

Example :

<?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.

?>

參考 : strtoupper( )  strtolower( )


上一頁 首頁 下一頁