PHP如何将字符串拆分为数组元素


php how to split a string into array elements?

我们有行:

1 test1
<br> 
2 test2
<br> 
3 test3
<br> 
4 test4

For explosion in array我们测试next:

$ArrText = explode("'n",$text);
$ArrText = explode("<br>",$text);

但是没有成功。

请告诉我如何将字符串分割成数组元素

$ArrText = explode("'n<br>'n",$text);

两件事:

  1. 你必须用一个新的行分隔,然后是<br>,然后是一个新的行
  2. 转义字符只能用双引号,不能用单引号。