【发布时间】:2016-05-19 12:27:26
【问题描述】:
如何获取包含所有字符串的数组。
$str = "This is some a text with [b]Bold[/b] and [i]Italic[/i] elements inside";
preg_match_all("/.*(\[.+\]).*/isU",$str,$matches);
print_r($matches);
我只得到:
Array (
[0] => Array
(
[0] => This is a text with [b]
[1] => Bold[/b]
[2] => and [i]
[3] => Italic[/i]
)
[1] => Array
(
[0] => [b]
[1] => [/b]
[2] => [i]
[3] => [/i]
)
)
最后没有“内部元素”文本。
【问题讨论】:
-
为您展示理想/预期的结果
标签: php arrays preg-match-all