<?PHP
$str="The best time is no time";
$arr=explode(" ",$str);
foreach($arr as $i) echo "$i, "; //The, best, time, is, no, time,
?>
The separator can also be a string.
<?PHP
$str="The best time is no time";
$arr=explode("time",$str);
foreach($arr as $i) echo "$i, "; //The best , is no , ,
?>
If the returned array element number n is specified, then the return array will be consisted of the first n-1 elements, and all the remaining elements will be combined into the last element.
<?PHP
$str="The best time is no time";
$arr=explode(" ",$str,3);
foreach($arr as $i) echo "$i, "; //The, best, time is no time,
?>
If the specified return element number n < 0, then return all other elements except the last n elements.
<?PHP
$str="The best time is no time";
$arr=explode(" ",$str,-1);
foreach($arr as $i) echo "$i, "; //The, best, time, is, no,
?>
<?PHP
$arr=array("php","js","python");
$str=implode(" + ", $arr);
echo "$str"; //php + js + python
?>
if you want to use regular expression as the separator, you can use
<?PHP
$str="<td>One<td>two<td>three<td>four";
$arr=preg_split('/\<td\>/',$str);
foreach($arr as $element) echo "$element, "; //, One, two, three, four,
?>
<?PHP
$str=htmlspecialchars('<table><tr><td>name<td>address</table>');
echo $str;
//<table><tr><td>name<td>address</table>
$str2 = htmlspecialchars_decode($str);
echo $str2;
//<table><tr><td>name<td>address</table>
?>