GyuHa.com



echo "<pre>";
print_r($elDay);
echo "</pre>";

Array
(
    [7] => 1
    [10] => 12
    [13] => 13
    [15] => 26
    [20] => 27
    [27] => 29
)

$keys = array_keys($elDay); //키값으로 분리해 놓기
array_multisort($keys, SORT_ASC);
$values = array_values($elDay); //값으로 분리해 놓기

Array  //키 배열 
(
    [0] => 7
    [1] => 10
    [2] => 13
    [3] => 15
    [4] => 20
    [5] => 27
)
Array  //값 배열
(
    [0] => 1
    [1] => 12
    [2] => 13
    [3] => 26
    [4] => 27
    [5] => 29
)
$new_arr = array_combine($keys, $values); //정렬후 합치기

echo "<pre>";
//print_r($new_arr);
echo "</pre>";

Array
(
    [7] => 1
    [10] => 12
    [13] => 13
    [15] => 26
    [20] => 27
    [27] => 29
)

Comment +0