亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

搜索
博主信息
博文 37
粉絲 0
評(píng)論 0
訪問量 43384
最新下載
更多>
網(wǎng)站特效
網(wǎng)站源碼
網(wǎng)站素材
前端模板
字符串函數(shù)
手機(jī)用戶1607314868
原創(chuàng)
801人瀏覽過
  1. ltrim 刪除字符串開頭的空白字符(或其他字符)
    ltrim(輸入字符串,指定想要?jiǎng)h除的字符) : string
    該函數(shù)返回一個(gè)刪除了str最左邊的空白字符的字符串
  1. $hello = "Hello World";
  2. $trimmed = ltrim($hello, "Hdle");
  3. var_dump($trimmed);

2.str_shuffle — 隨機(jī)打亂一個(gè)字符串
str_shuffle(字符串) : string

  1. $str = 'abcdef';
  2. $shuffled = str_shuffle($str);
  3. echo $shuffled;

3.strlen — 獲取字符串長(zhǎng)度
strlen( string $string) : int

  1. $str = 'abcdef';
  2. echo strlen($str);

4.strrev — 反轉(zhuǎn)字符串
strrev( string $string) : string
echo strrev("Hello world!");

5.str_repeat — 重復(fù)一個(gè)字符串
str_repeat( string $input, int $multiplier) : string
echo str_repeat("-=", 10);

6.addcslashes — 以 C 語言風(fēng)格使用反斜線轉(zhuǎn)義字符串中的字符
addcslashes(要轉(zhuǎn)義的字符串,轉(zhuǎn)義字符的范圍) : string
echo addcslashes('foo[ ]', 'A..z');

7.addslashes — 使用反斜線引用字符串
addslashes( string $str) : string

  1. $str = "Is your name O'reilly?";
  2. echo addslashes($str);

8.rtrim — 刪除字符串末端的空白字符(或者其他字符)

  1. //rtrim( string $str, string $character_mask = ?) : string
  2. $trimmed = rtrim($hello, "Hdle");

9.strip_tags — 從字符串中去除 HTML 和 PHP 標(biāo)記
strip_tags( string $str,指定不被去除的字符列表) : string

10.strtolower — 將字符串轉(zhuǎn)化為小寫

  1. //strtolower( string $string) : string
  2. $str = "Mary Had A Little Lamb and She LOVED It So";
  3. $str = strtolower($str);

11.strtoupper — 將字符串轉(zhuǎn)化為大寫

  1. // strtoupper( string $string) : string
  2. $str = "Mary Had A Little Lamb and She LOVED It So";
  3. $str = strtoupper($str);

// 12.trim — 去除字符串首尾處的空白字符(或者其他字符)

  1. $hello = " Hello Worl ";
  2. trim($hello, "Hdle");
  3. var_dump($trimmed);

13.ucfirst — 將字符串的首字母轉(zhuǎn)換為大寫

  1. $foo = 'hello world!';
  2. $foo = ucfirst($foo);

14.ucwords — 將字符串中每個(gè)單詞的首字母轉(zhuǎn)換為大寫

  1. //ucwords( string $str, string $delimiters = " \t\r\n\f\v" ) : string
  2. $foo = 'hello world!';
  3. $foo = ucwords($foo);

15.ucfirst — 將字符串的首字母轉(zhuǎn)換為大寫
將 str 的首字符(如果首字符是字母)轉(zhuǎn)換為大寫字母,并返回這個(gè)字符串。

  1. $foo = 'hello world!';
  2. $foo = ucfirst($foo);

16.strtolower — 將字符串轉(zhuǎn)化為小寫

  1. // 將 string 中所有的字母字符轉(zhuǎn)換為小寫并返回。
  2. $str = "Mary Had A Little Lamb and She LOVED It So";
  3. $str = strtolower($str);

17.strtoupper — 將字符串轉(zhuǎn)化為大寫

  1. //將 string 中所有的字母字符轉(zhuǎn)換為大寫并返回
  2. $str = "Mary Had A Little Lamb and She LOVED It So";
  3. $str = strtoupper($str);

18 lcfirst — 使一個(gè)字符串的第一個(gè)字符小寫

  1. // 返回第一個(gè)字母小寫的 str ,如果是字母的話
  2. $foo = 'HelloWorld';
  3. $foo = lcfirst($foo);

19 htmlspecialchars — 將特殊字符轉(zhuǎn)換為 HTML 實(shí)體

  1. $new = htmlspecialchars("<a href='test'>Test</a>", ENT_QUOTES);
  2. echo $new;

20 strcmp — 二進(jìn)制安全字符串比較

  1. //strcmp( string $str1, string $str2) : int
  2. //如果 str1 小于 str2 返回 < 0;如果 str1 大于 str2 返回 > 0;如果兩者相等,返回 0。
  3. $var1 = "Hello";
  4. $var2 = "hello";
  5. if (strcmp($var1, $var2) !== 0) {
  6. echo '$var1 is not equal to $var2 in a case sensitive string comparison';
  7. }
批改老師:天蓬老師天蓬老師

批改狀態(tài):合格

老師批語:
本博文版權(quán)歸博主所有,轉(zhuǎn)載請(qǐng)注明地址!如有侵權(quán)、違法,請(qǐng)聯(lián)系admin@php.cn舉報(bào)處理!
全部評(píng)論 文明上網(wǎng)理性發(fā)言,請(qǐng)遵守新聞評(píng)論服務(wù)協(xié)議
0條評(píng)論
作者最新博文
關(guān)于我們 免責(zé)申明 意見反饋 講師合作 廣告合作 最新更新
php中文網(wǎng):公益在線php培訓(xùn),幫助PHP學(xué)習(xí)者快速成長(zhǎng)!
關(guān)注服務(wù)號(hào) 技術(shù)交流群
PHP中文網(wǎng)訂閱號(hào)
每天精選資源文章推送
PHP中文網(wǎng)APP
隨時(shí)隨地碎片化學(xué)習(xí)
PHP中文網(wǎng)抖音號(hào)
發(fā)現(xiàn)有趣的

Copyright 2014-2025 http://ipnx.cn/ All Rights Reserved | php.cn | 湘ICP備2023035733號(hào)

  • 登錄PHP中文網(wǎng),和優(yōu)秀的人一起學(xué)習(xí)!
    全站2000+教程免費(fèi)學(xué)