Return string truncation loop

Source: Internet
Author: User
Return string truncation loop $ return & nbsp; return value: & nbsp; 9 | 50 | 1 | # | 2013-09-09 & nbsp; 00:00:22 | 13814002394 | content | 1 | # | 2013-09-09 & nbsp; 00:00:19 | 13814002394 | content | 1 |#| 2013-09-07 & nbsp; 00:51:57 | 15920531400 | returns a string truncation loop.
The return value of $ return is
9 | 50
| 1 | # | 00:00:22 | 13814002394 | content
| 1 | # | 00:00:19 | 13814002394 | content
| 1 | # | 00:51:57 | 15920531400 | content
| 1 | # | 22:21:02 | 15920531400 | content
| 1 | # | 22:13:14 | 15920531400 | content
| 1 | # | 22:07:42 | 15920531400 | content
| 1 | # | 14:00:02 | 15920531400 | content
| 1 | # | 12:10:13 | 15920531400 | content
| 1 | # | 12:01:27 | 15920531400 | content
| 1 | # |

// This is sorted

Is a regular string (not an array)
I changed to a cyclable array, where time, number, and content are variables !!!!!


------ 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 "
";
?>
I simply wrote it and joined it. I don't know if there is any 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.