2011-04-14 168 views
0

我试图解决这类型的数组:如何按日期排序此数组?

array (
    0 => 
    array (
    'id_ouverture' => 5, 
    'debut' => '2011-04-25 08:00:00', 
    'fin' => '2011-04-25 20:00:00', 
    'id_salle' => 
    array(
     'id' => '7', 
     'nom' => 'BLABLA', 
     'id_type_salle' => '3', 
     'visible' => 1,   
    ), 
), 
    1 => 
    array (
    'id_ouverture' => 6, 
    'debut' => '2011-04-18 08:00:00', 
    'fin' => '2011-04-18 10:45:00', 
    'id_salle' => 
    array(
     'id' => '7', 
     'nom' => 'BLABLA', 
     'id_type_salle' => '3', 
     'visible' => 1,   
    ), 
), 
    2 => 
    array (
    'id_ouverture' => 7, 
    'debut' => '2011-05-02 08:00:00', 
    'fin' => '2011-05-02 10:45:00', 
    'id_salle' => 
    array(
     'id' => '7', 
     'nom' => 'BLABLA', 
     'id_type_salle' => '3', 
     'visible' => 1, 
    ), 
), 
    3 => 
    array (
    'id_ouverture' => 8, 
    'debut' => '2011-05-09 08:00:00', 
    'fin' => '2011-05-09 10:45:00', 
    'id_salle' => 
    array(
     'id' => '7', 
     'nom' => 'BLABLA', 
     'id_type_salle' => '3', 
     'visible' => 1,   
    ), 
)); 

我需要排序这个键在这个数组:数组[$ i] [“处女作”]升序排列的。

结果必然是:

array (
    1 => 
    array (
    'id_ouverture' => 6, 
    'debut' => '2011-04-18 08:00:00', 
    'fin' => '2011-04-18 10:45:00', 
    'id_salle' => 
    array(
     'id' => '7', 
     'nom' => 'BLABLA', 
     'id_type_salle' => '3', 
     'visible' => 1,   
    ), 
), 
    0 => 
    array (
    'id_ouverture' => 5, 
    'debut' => '2011-04-25 08:00:00', 
    'fin' => '2011-04-25 20:00:00', 
    'id_salle' => 
    array(
     'id' => '7', 
     'nom' => 'BLABLA', 
     'id_type_salle' => '3', 
     'visible' => 1,   
    ), 
), 

    2 => 
    array (
    'id_ouverture' => 7, 
    'debut' => '2011-05-02 08:00:00', 
    'fin' => '2011-05-02 10:45:00', 
    'id_salle' => 
    array(
     'id' => '7', 
     'nom' => 'BLABLA', 
     'id_type_salle' => '3', 
     'visible' => 1, 
    ), 
), 
    3 => 
    array (
    'id_ouverture' => 8, 
    'debut' => '2011-05-09 08:00:00', 
    'fin' => '2011-05-09 10:45:00', 
    'id_salle' => 
    array(
     'id' => '7', 
     'nom' => 'BLABLA', 
     'id_type_salle' => '3', 
     'visible' => 1,   
    ), 
)); 

你有一个想法,办呢?

回答