PHP英文字母大小寫轉(zhuǎn)換函數(shù)小結(jié)
每個單詞的首字母轉(zhuǎn)換為大寫:ucwords()
$foo = 'hello world!';
$foo = ucwords($foo); // Hello World!
$bar = 'HELLO WORLD!';
$bar = ucwords($bar); // HELLO WORLD!
$bar = ucwords(strtolower($bar)); // Hello World!
?>
第一個單詞首字母變大寫:ucfirst()
$foo = 'hello world!';
$foo = ucfirst($foo); // Hello world!
$bar = 'HELLO WORLD!';
$bar = ucfirst($bar); // HELLO WORLD!
$bar = ucfirst(strtolower($bar)); // Hello world!
?>
第一個單詞首字母變小寫:lcfirst()
$foo = 'HelloWorld';
$foo = lcfirst($foo); // helloWorld
$bar = 'HELLO WORLD!';
$bar = lcfirst($bar); // hELLO WORLD!
$bar = lcfirst(strtoupper($bar)); // hELLO WORLD!
?>
所有字母變大寫:strtoupper()
所有字母變小寫:strtolower()
相關(guān)文章
php-perl哈希算法實現(xiàn)(times33哈希算法)
php-perl哈希實現(xiàn)算法–DJBX33A(Daniel J. Bernstein, Times 33 with Addition)APR哈希默認算法2013-12-12php 模擬GMAIL,HOTMAIL(MSN),YAHOO,163,126郵箱登錄的詳細介紹
本篇文章是對php模擬GMAIL,HOTMAIL(MSN),YAHOO,163,126郵箱登錄的方法進行了詳細的分析介紹,需要的朋友參考下2013-06-06php獲得客戶端瀏覽器名稱及版本的方法(基于ECShop函數(shù))
這篇文章主要介紹了php獲得客戶端瀏覽器名稱及版本的方法,基于ECShop函數(shù)get_user_browser實現(xiàn)該功能,非常具有實用價值,需要的朋友可以參考下2015-12-12無法載入 mcrypt 擴展,請檢查 PHP 配置終極解決方案
今天運行phpmyadmin的時候,提示無法載入 mcrypt 擴展,經(jīng)排查原來是php配置問題。2011-07-07PHP基于PDO實現(xiàn)的SQLite操作類【包含增刪改查及事務等操作】
這篇文章主要介紹了PHP基于PDO實現(xiàn)的SQLite操作類,包含增刪改查及事務等操作實現(xiàn)技巧與使用方法,需要的朋友可以參考下2017-06-06php 出現(xiàn)Strict Standards: Only variables should be passed by r
這個問題多半是因為引用傳遞參數(shù)引起的,解決辦法一是修改代碼不使用引用傳遞,需要的朋友可以參考下2017-08-08