Back string intercept loop

Source: Internet
Author: User
return string intercept loop
$return The return value is
9| | 50
|| 1|#|2013-09-09 00:00:22| | 13814002394| | Content
|| 1|#|2013-09-09 00:00:19| | 13814002394| | Content
|| 1|#|2013-09-07 00:51:57| | 15920531400| | Content
|| 1|#|2013-09-06 22:21:02| | 15920531400| | Content
|| 1|#|2013-09-06 22:13:14| | 15920531400| | Content
|| 1|#|2013-09-06 22:07:42| | 15920531400| | Content
|| 1|#|2013-09-05 14:00:02| | 15920531400| | Content
|| 1|#|2013-09-05 12:10:13| | 15920531400| | Content
|| 1|#|2013-09-05 12:01:27| | 15920531400| | Content
|| 1|#|

It's been sorted out.

is a regular string (not an array)
I become a recyclable array where time, number, content is variable!!!!!


------Solution--------------------
 $str = ' 9
------Solution--------------------
50

------Solution--------------------
1
------Solution--------------------
#
------Solution--------------------
2013-09-09 00:00:22
------Solution--------------------
13814002394
------Solution--------------------
Content

------Solution--------------------
1
------Solution--------------------
#
------Solution--------------------
2013-09-09 00:00:19
------Solution--------------------
13814002394
------Solution--------------------
Content

------Solution--------------------
1
------Solution--------------------
#
------Solution--------------------
2013-09-07 00:51:57
------Solution--------------------
15920531400
------Solution--------------------
Content

------Solution--------------------
1
------Solution--------------------
#
------Solution--------------------
2013-09-06 22:21:02
------Solution--------------------
15920531400
------Solution--------------------
Content

------Solution--------------------
1
------Solution--------------------
#
------Solution--------------------
2013-09-06 22:13:14
------Solution--------------------
15920531400
------Solution--------------------
Content

------Solution--------------------
1
------Solution--------------------
#
------Solution--------------------
2013-09-06 22:07:42
------Solution--------------------
15920531400
------Solution--------------------
Content

------Solution--------------------
1
------Solution--------------------
#
------Solution--------------------
2013-09-05 14:00:02
------Solution--------------------
15920531400
------Solution--------------------
Content

------Solution--------------------
1
------Solution--------------------
#
------Solution--------------------
2013-09-05 12:10:13
------Solution--------------------
15920531400
------Solution--------------------
Content

------Solution--------------------
1
------Solution--------------------
#
------Solution--------------------
2013-09-05 12:01:27
------Solution--------------------
15920531400
------Solution--------------------
Content

------Solution--------------------
1
------Solution--------------------
#
------Solution--------------------
';
$new _str=str_replace ('
------Solution--------------------
','
------Solution--------------------
', $STR);
$arr =explode ('
------Solution--------------------
1
------Solution--------------------
#
------Solution--------------------
', $new _str);
$new _arr=array ();
foreach ($arr as $value)
{
Echo $value;
if (Substr_count ($value, '
------Solution--------------------
') >1)
{
$new _arr[]=explode ('
------Solution--------------------
', $value);
}
}
echo "
";
Print_r ($new _arr);
echo "
";
?>
Simple write down, make up, don't know there is no better way
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.