一区二区三区在线-一区二区三区亚洲视频-一区二区三区亚洲-一区二区三区午夜-一区二区三区四区在线视频-一区二区三区四区在线免费观看

服務器之家:專注于服務器技術及軟件下載分享
分類導航

PHP教程|ASP.NET教程|Java教程|ASP教程|編程技術|正則表達式|C/C++|IOS|C#|Swift|Android|VB|R語言|JavaScript|易語言|vb.net|

服務器之家 - 編程語言 - PHP教程 - php的字符串用法小結

php的字符串用法小結

2019-10-31 14:39php教程網 PHP教程

php的字符串用法小結,剛開始接觸php字符串的朋友可以參考下。

1 求長度,最基本的 
$text = "sunny day"; 
$count = strlen($text); // $count = 9 


2 字符串截取 
截取前多少個字符 
$article = "BREAKING NEWS: In ultimate irony, man bites dog."; $summary = substr_replace($article, "...", 40); 

3 算單詞數 
$article = "BREAKING NEWS: In ultimate irony, man bites dog."; $wordCount = str_word_count($article); 
// $wordCount = 8 

4 將字符串變成HTML的連接 
$url = "W.J. Gilmore, LLC (//www.ythuaji.com.cn)"; 
$url = preg_replace("/http://([A-z0-9./-]+)/", "$0", $url); 

5 去除字符中的HTML字符串 
$text = strip_tags($input, " 
"); 

6 nl2br: 
$comment = nl2br($comment); 
變成帶HTML格式 

7 Wordwrap 
限制每行字數 
$speech = "Four score and seven years ago our fathers brought forth, upon this continent, a new nation, conceived in Liberty, and dedicated to the proposition that all men are created equal."; 
echo wordwrap($speech, 30); 

輸出: 
Four score and seven years ago our fathers brought forth, upon this continent, a new nation, conceived in Liberty, and dedicated to the proposition that all men are created equal.

延伸 · 閱讀

精彩推薦
主站蜘蛛池模板: 无限在线观看视频大全免费高清 | tube69中国露脸 | 护士videossexo另类 | 亚洲第五页| 国产视频福利 | 国产精品成人免费 | 日本精品一卡二卡≡卡四卡 | 无码人妻少妇色欲AV一区二区 | 欧美日韩一级视频 | 天堂成人在线 | 王的视频vk | 久久学生精品国产自在拍 | 免费观看www视频 | 色综合视频一区二区观看 | 精品国产免费第一区二区 | 激情六月丁香婷婷四房播 | naruto hentai玖辛奈| 欧美精品色精品一区二区三区 | 黄a一级 | 欧美在线视频一区二区 | 嫩草影院国产 | 特黄特色大片免费高清视频 | 希岛爱理作品在线观看 | 男人视频网 | 海派甜心完整版在线观看 | 婷婷sese| 欧美腐剧mm在线观看 | 午夜AV亚洲一码二中文字幕青青 | 国产全部理论片线观看 | 500第一精品 | 操动漫美女视频 | 丰满肥臀风间由美357在线 | 精品国产原创在线观看视频 | 特黄级 | 魔镜号中文字幕 | 果冻传媒在线观看的 | 亚洲国产精品福利片在线观看 | 91yellow吧字幕网zmff7 | 色视频亚洲 | 欧美同性猛男野外gay免费 | 五月天婷婷网亚洲综合在线 |