D
D
Dmitry2016-10-27 14:50:26
PHP
Dmitry, 2016-10-27 14:50:26

Create an array in descending order?

Hello!
There is a cycle:

foreach ($filtersArray as $filterArray) {

            $g = explode(";", $filterArray);

            $f[end($g)][reset($g)][] = $g[1];

        }

How can you create an array $f, immediately with values ​​in descending order?
Now I have to do a second cycle, but this is not entirely rational.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Artem, 2016-10-27
@proudmore

php.net/manual/ru/array.sorting.php

A
Alexey Aleksin, 2016-10-28
@leroyleroy

I feel that you should look at the bubble method :) Just google it - bubble sort :) Also suitable for multidimensional arrays.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question