php5與mysql5 web 開發技術詳解-2 字串操作_PHP教程

來源:互聯網
上載者:User
字串學習主要是掌握內建函數。函數太多,至今沒有記住多少,先簡單的把函數記錄下來,以後再做補充。 1、定義方式: 單引號、雙引號、或者{} {}顯示索引數組方便,雙引號解析變數2、手動轉意字串資料 \ 符號來實現 可用addslashes()、addcslashes()函數自訂轉移 3、序列化和還原序列化 serialize()、unserialize() 4、字串整理 trim()、ltrim()、rtrim() 去掉字串中的空格、分行符號(\n,\r)、水平和垂直定位字元(\t,\v)以及字串結束符(\0).5、格式化字串 nl2br() wordwrap() strtolower() strtoupper() ucfirst() ucwords()6、分割 explode() 和 同名 join() 例: explode("@",$email) ; 7、字串截取 substr(‘目標串',起點,終點)8、strlen() / mb_strlen() 9、str_word_count() 結合array_count_values() 統計單詞出現次數10、尋找www.2cto.com strstr($string,"關鍵字") ,stristr() ,strrch() strpos() str_repeat() substr_count()11、處理 str_replace() substr_replace() strrev() htmlspecialchars() ,htmlentitles() 將<,>,&, " 等特殊字元轉換為html實體 strip_tags() 清楚html標籤 strncmp(),strcmp() strok() 解析字串 strpbrk() strspn(),strcspn() str_replace()

http://www.bkjia.com/PHPjc/477718.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/477718.htmlTechArticle字串學習主要是掌握內建函數。 函數太多,至今沒有記住多少,先簡單的把函數記錄下來,以後再做補充。 1、定義方式: 單引號、雙引...

  • 聯繫我們

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