K
K
karetsky2018-04-16 13:19:03
PHP
karetsky, 2018-04-16 13:19:03

How to convert php array?

How to convert an array to php, let's say $arr=array('1','2','3','4','5','10','11','15','20');
In the line: "1-5, 10-11, 15, 20"
i.e. from the elements following in order, make gaps

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
DevMan, 2018-04-16
@karetsky

How to make a sequence of arrays? - the answer to exactly the same question.

M
Maxim Timofeev, 2018-04-16
@webinar

Iterate with for, form a new array. If the previous element differs by 1, we form a gap, if not, we fuck it as it is.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question