Home >Backend Development >PHP Tutorial >随机打乱指定字符间内容的顺序

随机打乱指定字符间内容的顺序

WBOY
WBOYOriginal
2016-06-23 13:07:071031browse


11111111
你好他好




222222222
我好都好




3333333333
我好都好




444444444
我好都好




555555555
我好都好




PHP随机打乱上面位置随机换下,保留,包括里面的符号中文字都不出错,


回复讨论(解决方案)

= =!    连题目都看不懂 看来我还是太菜了

这个意思?

$s = <<<txt<url><loc>11111111</loc><wap_url>你好他好</wap_url><data></data></url><url><loc>222222222</loc><wap_url>我好都好</wap_url><data></data></url><url><loc>3333333333</loc><wap_url>我好都好</wap_url><data></data></url><url><loc>444444444</loc><wap_url>我好都好</wap_url><data></data></url><url><loc>555555555</loc><wap_url>我好都好</wap_url><data></data></url>txt;preg_match_all('/<url>.+<\/url>/isU', $s, $m);shuffle($m[0]);echo join($m[0], "\n");

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