From da71e326d6bbd7e531f0948cac99cf0c4d51ad6e Mon Sep 17 00:00:00 2001 From: Urban Müller Date: Fri, 30 Oct 2015 15:37:17 +0100 Subject: minimal it::sort --- it.class | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'it.class') diff --git a/it.class b/it.class index 073b2bf..b097e60 100644 --- a/it.class +++ b/it.class @@ -1030,5 +1030,12 @@ static function json_decode($json) return ($data = json_decode($json)) === null && $json != 'null' ? it::error(array('title' => "invalid json", 'body' => $json)) : $data; } +static function sort($array, $mode = "") +{ + $func = it::replace(array('n' => ""), count_chars($mode, 3)) . "sort"; # count_chars sorts flags + $func($array, it::match('n', $mode) ? SORT_NUMERIC : 0); + + return $array; +} + } -?> -- cgit v1.2.3