'); })();

PHP array_multisort 多维数组排序 不区分大小写

$options = array();
foreach ($this->getCustomer()->getAddresses() as $address) {
$options[] = array(
‘value’ => $address->getId(),
label‘ => $address->format(‘oneline’)
);
}
//var_dump($options);

//label 字段按字母不区分大小写排序:
$first_names = array_column($options,’label‘);
array_multisort($first_names,SORT_ASC,SORT_NATURAL|SORT_FLAG_CASE,$options);
//var_dump($options);

相关文章