fork(1) download
  1. <?php
  2.  
  3. $res = array();
  4. $res[] = array("16/08/2013", "13:32", "ROBERTO");
  5. $res[] = array("16/08/2013", "13:16", "AMANDA");
  6. $res[] = array("14/08/2013", "12:36", "SILMARA");
  7. $res[] = array("14/08/2013", "", "ROBERTO");
  8. $res[] = array("14/08/2013", "", "KATIA");
  9. $res[] = array("13/10/2015", "16:47", "ROBERTO");
  10. $res[] = array("14/08/2013", "", "SILMARA");
  11. $res[] = array("14/08/2013", "", "AMANDA");
  12.  
  13. uasort( $res, 'compara' );
  14. print_r( $res );
  15.  
  16. function compara( $a1, $a2 ) {
  17. $ts1 = substr($a1[0],6,4).substr($a1[0],3,2).substr($a1[0],0,2).$a1[1];
  18. $ts2 = substr($a2[0],6,4).substr($a2[0],3,2).substr($a2[0],0,2).$a2[1];
  19. return strcmp($ts1, $ts2);
  20. }
  21.  
Success #stdin #stdout 0.03s 52480KB
stdin
Standard input is empty
stdout
Array
(
    [6] => Array
        (
            [0] => 14/08/2013
            [1] => 
            [2] => SILMARA
        )

    [7] => Array
        (
            [0] => 14/08/2013
            [1] => 
            [2] => AMANDA
        )

    [4] => Array
        (
            [0] => 14/08/2013
            [1] => 
            [2] => KATIA
        )

    [3] => Array
        (
            [0] => 14/08/2013
            [1] => 
            [2] => ROBERTO
        )

    [2] => Array
        (
            [0] => 14/08/2013
            [1] => 12:36
            [2] => SILMARA
        )

    [1] => Array
        (
            [0] => 16/08/2013
            [1] => 13:16
            [2] => AMANDA
        )

    [0] => Array
        (
            [0] => 16/08/2013
            [1] => 13:32
            [2] => ROBERTO
        )

    [5] => Array
        (
            [0] => 13/10/2015
            [1] => 16:47
            [2] => ROBERTO
        )

)