substr(str,start,length);
例:substr('php教程 is very good language',4,5);
輸出為 is ve;
當start>str的長度,則返回為();
substr('php is very good language',26,5);
substr('php is very good language',4);
輸出為 (空白)
輸出為is v (表明start和langth都為4)
當start為負值,則從str末尾出開始讀起(*這時是從-1開始讀,而不是從0開始),
substr('php is very good language',-4,5);
輸出為uage
當length為負值時,length代表的是從末尾開始讀,截取str的結束位置。
substr('php is very good language',4,-5);
輸出為is very good lan
explode()把函數字符串分割為數組;
// example 1
$pizza = "piece1 piece2 piece3 piece4 piece5 piece6";
$pieces = explode(" ", $pizza);
echo $pieces[0]; // piece1
echo $pieces[1]; // piece2
// example 2
$data = "foo:*:1023:1000::/home/foo:/bin/sh";
list($user, $pass, $uid, $gid, $gecos, $home, $shell) = explode(":", $data);
echo $gecos."
"; // foo
echo $shell; // *
strrev()把字符串從後往前輸出
echo strrev("june"); // outputs "enuj"
setlocalhost(content location)設置本地環境.content ,指定需要設置的場景信息常量有(
lc_all – 所有下屬的常量
lc_collate – 排列順序
lc_ctype – 字符分類和轉換(例如:將所有的字符轉換成小寫或大寫形式)
lc_messages – 系統信息格式
lc_monetary – 貨幣 / 通貨格式
lc_numeric – 數值格式
lc_time – 日期和時間格式
);location,設置國家區域,例如,chs.