字串函數-大小寫轉化&html標籤關聯

來源:互聯網
上載者:User
<?php// strtolower()字串轉化為小寫var_dump(strtolower($str));echo "<hr/>";// strtoupper()字串轉化為大寫var_dump(strtoupper($str));echo "<hr/>";// ucfirst()字串首字母大寫$str3="hellow world nihao a";var_dump(ucfirst($str3));echo "<hr/>";// ucwords()字串每個單詞首字元轉為大寫var_dump(ucwords($str3));echo "<hr/>";// htmlentities()把字元轉為html實體$str5="<b>la''la</b><h1>haha</h1>";var_dump(htmlentities($str5));echo "<hr/>";// htmlspecialchars()預定義字元穿轉為html編碼var_dump(htmlspecialchars($str5));echo "<hr/>";// nl2br()\n轉移為<br>標籤$str6="hoho\nlalala";echo $str6;echo "<hr/>";echo nl2br($str6);echo "<hr/>";var_dump($str6);var_dump(nl2br($str6));echo "<hr/>";// strip_tags()剝去htmlentities.xml以及PHP的標籤var_dump(strip_tags($str5));echo "<hr/>";// addcslashes()在指定的字元前添加反斜線轉移字串中字元var_dump(addcslashes($str5,'a'));echo "<hr/>";// stripcsslashes()刪除由addcslashes()添加的反斜線echo stripcslashes("\ahelow\aiaam\najack");// addslashes()指定預定義字元前添加反斜線var_dump(addslashes($str5));echo "<hr/>";// stripslashers()刪除由addslashers()添加的逸出字元var_dump(stripslashes("\'ahelow\aiaam\'najack"));echo "<hr/>";// quotemeta()在字串中某些預定義的字元前添加反斜線var_dump(quotemeta("aa'asd'//asd./..()\\"));echo "<hr/>";// chr()從指定的ASCII值返回字元var_dump(chr(100));echo "<hr/>";// ord()返回字串第一個字元的ASCII值var_dump(ord("asdd ss")); echo "<hr/>";

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.