php中利用explode函式分割字串到陣列

2022-09-27 03:57:12 字數 785 閱讀 8200

分割字串

//利用 explode 函式分割字串到陣列

複製** **如下:

php

$so程式設計客棧urce = "hello1,hello2,hello3,hello4,hello5";//按逗號分離字串

$hello = explode(',',$

for($index=0;$index

?>

//split程式設計客棧函式進行字元分割

// 分隔符可以是斜線,點,或橫線

複製** **如下:

<?php

$date = "04/30/1973";

list($month, $day, $year) = split ('[/.-]', $date);

echo "month: $month; day: $day; year: $year

\n";

?>

通過陣列實現多條件查詢的**

複製** **如下:

<?php

$keyword="asp php,jsp";

$keyword"&prspjznbsp; "," ",$keyword);

$keyword=str_replace(" ",",",$keyword);

$keyarr=explode(',',$keyword);

for($index=0;$index

echo $wheresql;

本文標題: php中利用explode函式分割字串到陣列

本文位址:

php中explode函式用法分析

explode string separator,string string int limit separator 為空字串 explode 將返回 false,如果 separator 所包含的值在 string 中找不到,那麼 explode 將返回包含 string 單個元素的陣列.expl...

explode在PHP中的用法

php 3,php 4,php 5 explode 使用乙個字串分割另乙個字串描述 array explode string separator,string string int limit 此函式返回由字串組成的陣列,每個元素都是 string 的乙個子串,它們被字串 separator 作為邊...

explode在PHP中的用法

主要是注意explode的第三個引數 php3,php 4,php 5 explode 使用乙個字串分割另乙個字串描述 array explode string separator,string string int limit 此函式返回由字串組成的陣列,每個元素都是 string 的乙個子串,它...