Home  >  Article  >  Backend Development  >  批改一段代码,高手指教了

批改一段代码,高手指教了

WBOY
WBOYOriginal
2016-06-13 12:32:13836browse

修改一段代码,高手指教了

$char = "<div>11111</div><div>22222</div><div>33333</div>";<br />
preg_match_all("|<div>(.*)</div>|U", $char, $out,PREG_PATTERN_ORDER);<br />
echo $out[0][0];<br />
echo $out[0][1];<br />
echo $out[0][2];



上面这段代码可以获取字符串之间的值,但我要的效果是

我不知道字符串里有多少个

nnnnn
,我想获取所有div之间的所有值并且随机打乱顺序
比如字符串"
11111
22222
33333
44444
";
我想得到的结果是:
22222
44444
33333
11111



麻烦知道的高手直接给完整代码,谢谢了 
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn