标签:user round 字符 php col res xpl logs sql
str_replace 字符串匹配替换
$keyword="asp php,jsp"; $keyword=str_replace(" "," ",$keyword); echo $keyword; echo "<br>"; $keyword=str_replace(" ",",",$keyword); echo $keyword; echo "<br>"; $keyarr=explode(‘,‘,$keyword); for($index=0;$index<count($keyarr);$index++) { $whereSql .= " And (arc.title like ‘%$keyarr[$index]%‘ Or arc.keywords like ‘%$keyarr[$index]%‘) "; } echo $whereSql;
explode 拆分字符串成数组
<?php // 示例 1 $pizza = "piece1 piece2 piece3 piece4 piece5 piece6"; $pieces = explode(" ", $pizza); echo $pieces[0]; // piece1 echo $pieces[1]; // piece2 // 示例 2 $data = "foo:*:1023:1000::/home/foo:/bin/sh"; list($user, $pass, $uid, $gid, $gecos, $home, $shell) = explode(":", $data); echo $user; // foo echo $pass; // * ?>
<?php $date = "04/30/1973"; list($month, $day, $year) = split (‘[/.-]‘, $date); echo "Month: $month; Day: $day; Year: $year<br />\n"; ?>
str_replace 字符串匹配替换 explode 拆分数组
标签:user round 字符 php col res xpl logs sql
原文地址:http://www.cnblogs.com/benpaodegegen/p/7682647.html