我有以下数组:
$optionen_kosten = array(
"option_5" => array(
'monthly' => 2,
'setup' => 5
),
"option_3" => array(
'monthly' => 2,
'setup' => 5
),
"option_1" => array(
'monthly' => 2,
'setup' => 5
),
"option_6" => array(
'monthly' => 2,
'setup' => 5
),
"option_8" => array(
'monthly' => 2,
'setup' => 5
),
"option_10" => array(
'monthly' => 2,
'setup' => 5
),
"option_2" => array(
'monthly' => 2,
'setup' => 5
),
"option_4" => array(
'monthly' => 2,
'setup' => 5
),
"option_7" => array(
'monthly' => 2,
'setup' => 5
),
"option_9" => array(
'monthly' => 2,
'setup' => 5
)
);
现在,我想对该数组升序的键进行排序(option_1
,option_2
...)
我尝试使用ksort,但效果并不理想:
option_1
option_10
option_2
option_3
option_4
option_5
option_6
option_7
option_8
option_9
我希望option_10
成为最后一个。也许用uksort?
PHP版本:5.3.3