Answer the question
In order to leave comments, you need to log in
How to simply cluster the values of a one-dimensional array?
Let's have an array like this:
array(
1000 => 12,
1010 => 20,
1085 => 34,
1100 => 40,
1200 => 35,
1350 => 20,
1510 => 20,
2000 => 22,
2100 => 24,
2350 => 40,
3500 => 14,
4500 => 20,
6000 => 25
)
Answer the question
In order to leave comments, you need to log in
Hello.
I don't really understand what you are not satisfied with what you described?
And what do you end up wanting?
If you have a step of 500 rubles, and you start with 1000, then you will have exactly intervals with a step of 500. Everything that does not fall into the intervals will fall into the following intervals.
It turns out that you set the step, but you are waiting for a completely different interval.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question