PHP字串的總結

來源:互聯網
上載者:User

標籤:相互   其他   repeat   trre   位置   sla   mat   ber   encoding   

字串包括單雙引號,定位器、字串的串連、轉義和還原函數、截取、中文截取、分割、比較、檢索、替換、以及擷取字串的長度,格式化字串,去除字串首位空白字元、和字串與html的相互轉換。

strrev();將字元換倒過來

str_repeat();重複字串

strstr 尋找要找尋的字串在整個字串中第一次出現的位置,並且返回第一次出現位置的子串。

explode()按照特定的字元打亂成數組。

implode()將用explode分割的數組按照指定的字元還原成數組

str_replace()將字串中的某個字串替換成其他的字串  str_irepalce()不區分大小寫

addslashes()轉義函數

stripslashes()還原轉義的函數

strlen();擷取字串的長度,不同的編碼下,擷取到的長度不同。

substr();字串截取函數

mb_substr()用於漢字的截取函數

trim();去掉首尾空格以及其他符號的函數(包括\n\r \0\t\)

number_format()格式化字串函數

htmlentities()字串與html轉換函式

mb_convert_encoding()字串編碼轉換函式  to ,from

 

PHP字串的總結

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.