PHP:使用数组分隔符进行爆炸

时间:2016-07-07 20:14:58

标签: php arrays explode

我的字符串$content包含大量的文字。我想爆炸$content,分隔符是数组$array_explode中任何值的第一个资源。有谁可以帮助我?

类似的东西:

$content="...";
$array_explode = array("<br>", "<p>", "<h2>", "<h1>", "<h3>");
$content_explode = explode($array_explode, $content);

1 个答案:

答案 0 :(得分:-1)

<?php

$content = "...";
$content = str_replace(array("<br>", "<p>", "<h2>", "<h1>", "<h3>"), array("<br>".chr(30), "<p>".chr(30), "<h2>".chr(30), "<h1>".chr(30), "<h3>".chr(30)), $content);
$content_explode = explode(chr(30), $content);

?>