本文整理汇总了PHP中JArrayHelper::sortDirection方法的典型用法代码示例。如果您正苦于以下问题:PHP JArrayHelper::sortDirection方法的具体用法?PHP JArrayHelper::sortDirection怎么用?PHP JArrayHelper::sortDirection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JArrayHelper
的用法示例。
在下文中一共展示了JArrayHelper::sortDirection方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sortObjects
/**
* Utility function to sort an array of objects on a given field
*
* @param array &$a An array of objects
* @param mixed $k The key (string) or an array of keys to sort on
* @param mixed $direction Direction (integer) or an array of direction to sort in [1 = Ascending] [-1 = Descending]
* @param mixed $caseSensitive Boolean or array of booleans to let sort occur case sensitive or insensitive
* @param mixed $locale Boolean or array of booleans to let sort occur using the locale language or not
*
* @return array The sorted array of objects
*
* @since 11.1
* @deprecated 4.0 Use Joomla\Utilities\ArrayHelper::sortObjects instead
*/
public static function sortObjects(&$a, $k, $direction = 1, $caseSensitive = true, $locale = false)
{
if (!is_array($locale) || !is_array($locale[0])) {
$locale = array($locale);
}
self::$sortCase = (array) $caseSensitive;
self::$sortDirection = (array) $direction;
self::$sortKey = (array) $k;
self::$sortLocale = $locale;
usort($a, array(__CLASS__, '_sortObjects'));
self::$sortCase = null;
self::$sortDirection = null;
self::$sortKey = null;
self::$sortLocale = null;
return $a;
}