亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

How to display continuous values ??in groups? Please give me guidance and help from teachers.
JD26
JD26 2020-04-22 08:53:13
0
1
830

It’s not a database operation, it’s a PHP operation.

For example:

$a="1,2,3,4,5,6,7,8,9,10,11"

$b=" 8,9,10,11,12,13,17,18,19,20"

$c="10,11,12,13,14,15,16,18,20,21, 22,23,24"

Required results

$a="1-11"

$b="8-13,17 -20"

$c="10-16,18,20-24"

Please give me guidance

JD26
JD26

reply all(1)
一錘一座山

Let’s be a bit stupid and split it first $strList = explode(",",$str);

After that, we can loop from the first or last one and compare 1 and -1.

When not equal, output the start bit and end bit, and then continue to the next step of the cycle.

You can also use recursion.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template