S
S
Sergey Titov2015-12-17 06:59:20
PHP
Sergey Titov, 2015-12-17 06:59:20

How to sort array by date?

FQ0iHCfzQtA.jpg
Here is an example of an array, how can I sort it by the date in $array[$i][0]?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Mokhov, 2015-12-17
@Nuboskill

$yourArr = [];
usort($yourArr, function ($a, $b) {
    return $a[0] < $b[0] ? -1 : 1;
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question