I need to sort an array from the smallest date. I used Usort, but it order the array considering just the day. I tried using a code from an example using sort in javascript but i need this happen in php or find a way to convert php array to js.
Here is the code:
<?php
ArrayDates ( [0] => 22/03/2018 [1] => 09/04/2018 [2] => 26/03/2018
[3] => 27/11/2017 [4] => 22/01/2018 [5] => 06/09/2017 )
?>
<script>
ArrayDates.sort(function (a, b){
var aa = a.split('-'),
bb = b.split('-');
return aa[2] - bb[2] || aa[1] - bb[1] || aa[0] - bb[0];
})
</script>