تابع ucfirst : این تابع اولین کاراکتر هر رشته را بزرگ می کند.
تابع ucwords : این تابع اولین کاراکتر هر کلمه در یک رشته را بزرگ می کند.
مثال :
<?php
// define string
$str="http://rasekhoon.net designed by asp.net";
// uppercase first character of string
// result: "Http://rasekhoon.net designed by asp.net"
$ucfstr = ucfirst($str);
echo "$ucfstr<br>";
// uppercase first character of every word of string
// result: "Http://rasekhoon.net Designed By Asp.net"
$ucwstr = ucwords($str);
echo $ucwstr;
?>
خروجی :
Http://rasekhoon.net designed by asp.net
Http://rasekhoon.net Designed By Asp.net
همین طور که مشاهده می کنید تابع ucfirst اولین حرف رشته را بزرگ کرده و تابع ucwords حرف اول تمام کلمات را بزرگ کرده است.