求大侠帮忙

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-23 13:56:521087browse

1234求大侠帮忙56的78求大侠帮忙

怎么把上面这个段字符串分割成

1234
求大侠帮忙
56的78
求大侠帮忙

这样的数组


回复讨论(解决方案)

$str='1234<img  src="/static/imghwm/default1.png"  data-src="74.swf"  class="lazy"  / alt="求大侠帮忙" >56的78<img  src="/static/imghwm/default1.png"  data-src="68.swf"  class="lazy"  / alt="求大侠帮忙" >';$arr1=preg_split('/<.*>/U',$str);array_pop($arr1);preg_match_all('/<.*>/U',$str,$arr2);$arr3=array_merge($arr1,$arr2);print_r($arr3);


Array(    [0] => 1234    [1] => 56的78    [2] => Array        (            [0] => <img  src="/static/imghwm/default1.png"  data-src="74.swf"  class="lazy"  / alt="求大侠帮忙" >            [1] => <img  src="/static/imghwm/default1.png"  data-src="68.swf"  class="lazy"  / alt="求大侠帮忙" >        ))

$str='1234<img  src="/static/imghwm/default1.png"  data-src="74.swf"  class="lazy"  / alt="求大侠帮忙" >56的78<img  src="/static/imghwm/default1.png"  data-src="68.swf"  class="lazy"  / alt="求大侠帮忙" >';$arr1=preg_split('/<.*>/U',$str);array_pop($arr1);preg_match_all('/<.*>/U',$str,$arr2);$arr3=array_merge($arr1,$arr2);print_r($arr3);


Array(    [0] => 1234    [1] => 56的78    [2] => Array        (            [0] => <img  src="/static/imghwm/default1.png"  data-src="74.swf"  class="lazy"  / alt="求大侠帮忙" >            [1] => <img  src="/static/imghwm/default1.png"  data-src="68.swf"  class="lazy"  / alt="求大侠帮忙" >        ))


谢谢大侠,可以按顺序吗。
必须
(1)1234
(2)求大侠帮忙
(3)56的78
(4)求大侠帮忙
这样的顺序

$s='1234<img  src="/static/imghwm/default1.png"  data-src="74.swf"  class="lazy"  / alt="求大侠帮忙" >56的78<img  src="/static/imghwm/default1.png"  data-src="68.swf"  class="lazy"  / alt="求大侠帮忙" >';preg_match_all('/([^<>]+|<[^>]+>)/', $s, $m);print_r($m[0]);

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
Previous article:菜鸟,json输出Next article:求高效算法找