//利用 explode 函數(shù)分割字符串到數(shù)組 復(fù)制代碼 代碼如下: <?php $source = "hello1,hello2,hello3,hello4,hello5";//按逗號(hào)分離字符串 $hello = explode(',',$source);

for($index=0;$index<count($ " /> 中文字幕日韩视频,亚洲一区二区三区视频,在线视频国产区

色尼玛亚洲综合影院,亚洲3atv精品一区二区三区,麻豆freexxxx性91精品,欧美在线91

php中利用explode函數(shù)分割字符串到數(shù)組

分割字符串

//利用 explode 函數(shù)分割字符串到數(shù)組
復(fù)制代碼 代碼如下:
<?php
$source = "hello1,hello2,hello3,hello4,hello5";//按逗號(hào)分離字符串
$hello = explode(',',$source);

for($index=0;$index<count($hello);$index++)
{
echo $hello[$index];echo "</br>";
}
?>

//split函數(shù)進(jìn)行字符分割
// 分隔符可以是斜線,點(diǎn),或橫線
復(fù)制代碼 代碼如下:
<?php
$date = "04/30/1973";
list($month, $day, $year) = split ('[/.-]', $date);
echo "Month: $month; Day: $day; Year: $year<br />/n";
?>


通過(guò)數(shù)組實(shí)現(xiàn)多條件查詢的代碼

復(fù)制代碼 代碼如下:
<?php
$keyword="ASP php,jsp";
$keyword=str_replace("  "," ",$keyword);
$keyword=str_replace(" ",",",$keyword);
$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;

php技術(shù)php中利用explode函數(shù)分割字符串到數(shù)組,轉(zhuǎn)載需保留來(lái)源!

鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請(qǐng)第一時(shí)間聯(lián)系我們修改或刪除,多謝。

主站蜘蛛池模板: 常德市| 治多县| 西乌| 鄯善县| 漳平市| 额济纳旗| 大邑县| 阳高县| 河东区| 古浪县| 柳州市| 舟山市| 常德市| 固镇县| 水富县| 枣庄市| 井陉县| 瑞丽市| 岳普湖县| 巴东县| 宜宾市| 鄯善县| 绥化市| 溧水县| 吐鲁番市| 纳雍县| 华亭县| 南岸区| 福清市| 怀来县| 班玛县| 龙岩市| 南安市| 商南县| 乌兰浩特市| 高州市| 搜索| 外汇| 抚远县| 永济市| 双流县|