I have a function that returns an array with the values as numbers. The array values are dynamic and will change all the time.
The numbers have a set range, with the higher value determined by the last digit (i.e _1,2,3)
Im not sure if range() is the answer but I'll include them here.
e.g. of ranges:
100_1 100_2 100_3 101_1 101_2 101_3 102_1 102_2 102_3 103_1 103_2 103_3 104_1 104_2 104_3
For this example the returned array is as follows:
Array
(
[0] => 100_1
[1] => 100_2
[2] => 100_3
[3] => 101_1
[4] => 102_1
[5] => 102_2
[6] => 103_1
[7] => 103_2
[8] => 103_3
[9] => 104_1
[10] => 104_2
)
What I would like is to foreach(), (or similar) the array and return it like this:
Array
(
[1] => 100_3
[2] => 101_1
[3] => 102_2
[4] => 103_3
[5] => 104_2
)
If you notice only the higher values have been returned according to the set range.
As I am a newbie to php is there a simple solution I can understand? I appreciate any help thanks.