mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Renamed $sortby to $sortBy in sortByKey
This commit is contained in:
parent
b4a0182bf0
commit
c44135a50b
1 changed files with 4 additions and 4 deletions
|
@ -125,22 +125,22 @@ TEXT;
|
||||||
if (!function_exists('sortByKey')) {
|
if (!function_exists('sortByKey')) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sorts given $array by key $sortby.
|
* Sorts given $array by key $sortBy.
|
||||||
*
|
*
|
||||||
* @param array $array Array to sort
|
* @param array $array Array to sort
|
||||||
* @param string $sortby Sort by this key
|
* @param string $sortBy Sort by this key
|
||||||
* @param string $order Sort order asc/desc (ascending or descending).
|
* @param string $order Sort order asc/desc (ascending or descending).
|
||||||
* @param integer $type Type of sorting to perform
|
* @param integer $type Type of sorting to perform
|
||||||
* @return mixed Sorted array
|
* @return mixed Sorted array
|
||||||
* @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#sortByKey
|
* @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#sortByKey
|
||||||
*/
|
*/
|
||||||
function sortByKey(&$array, $sortby, $order = 'asc', $type = SORT_NUMERIC) {
|
function sortByKey(&$array, $sortBy, $order = 'asc', $type = SORT_NUMERIC) {
|
||||||
if (!is_array($array)) {
|
if (!is_array($array)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($array as $key => $val) {
|
foreach ($array as $key => $val) {
|
||||||
$sa[$key] = $val[$sortby];
|
$sa[$key] = $val[$sortBy];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($order === 'asc') {
|
if ($order === 'asc') {
|
||||||
|
|
Loading…
Reference in a new issue