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

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

WBOY
Release: 2016-06-13 12:32:13
Original
876 people have browsed it

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

$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];
Copy after login



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

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



麻烦知道的高手直接给完整代码,谢谢了

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template