按字母顺序排序下拉框

时间:2014-12-17 16:41:36

标签: php

我有这个代码,我需要按字母顺序排序。有什么帮助吗?

$first = JHTML::_('select.option', 0, _JSHOP_SEARCH_ALL_MANUFACTURERS, 'manufacturer_id', 'name');

    $_manufacturers = JTable::getInstance('manufacturer', 'jshop');

    $manufacturers = $_manufacturers->getList();

    array_unshift($manufacturers, $first);

    $list_manufacturers = JHTML::_('select.genericlist', $manufacturers, 'manufacturer_id', 'class = "inputbox" size = "1"','manufacturer_id','name' );

1 个答案:

答案 0 :(得分:0)

使用排序

对数组进行排序
sort($manufacturers);