2 字符串截取 截取前多少個字符 $article = "BREAKING NEWS: In ultimate irony, man bites dog."; $summary = substr_replace($ar " /> 在线不卡一区,一级在线播放,国产午夜在线

四虎精品视频-四虎精品成人免费网站-四虎黄色网-四虎国产视频-国产免费91-国产蜜臀97一区二区三区

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 (http://www.jb51.NET)";
$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.

php技術php的字符串用法小結,轉載需保留來源!

鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。

主站蜘蛛池模板: 黄网站免费在线播放| 梁君诺| 绿雾影视| christie stevens| 王同辉| 命运航班| 蹲着吐一地呕吐视频| 热爱 电影| 你在想什么| 玛丽与魔女之花| 朴信惠电视剧| 开国大典ppt课件| 免费看黄网站在线| 默读车| 寂静之城| 高见立下| 无懈可击图片| 俺去也电影网| 速度与激情10免费观看完整电影 | deaf dj课文翻译| 打男生军人光屁股的网站视频| 珂尼娜| 寒战2剧情解析| 巢谷传| 欧美xxxx做受性欧美蜜臀av| 岩男润子| 恶魔在线观看免费观看全集高清| 基兰·拉奥| 就爱小姐姐| 李英恩| 王渝萱主演的电影大全| douying.com| 王思聪是谁| 浙江卫视奔跑吧官网| 国产成人亚洲综合a∨婷婷| 兔子电影| 速度与激情:特别行动 电影| 头像图片女ins高级质感| 日本电视剧《阿信》| 《致青春》电影| 赖小子|