protected function sort($data,$cond) {
		$cols=\Base::instance()->split($cond);
		uasort(
			$data,
			function($val1,$val2) use($cols) {
				foreach ($cols as $col) {
					$parts=explode(' ',$col,2);
					$order=empty($parts[1])?
						SORT_ASC:
						constant($parts[1]);
					$col=$parts[0];
					if (!array_key_exists($col,$val1))
						$val1[$col]=NULL;
					if (!array_key_exists($col,$val2))
						$val2[$col]=NULL;
					list($v1,$v2)=[$val1[$col],$val2[$col]];
					if ($out=strnatcmp($v1,$v2)*
						(($order==SORT_ASC)*2-1))
						return $out;
				}
				return 0;
			}
		);
		return $data;
	}
protected function sort($data,$cond) {
		$cols=\Base::instance()->split($cond);
		uasort(
			$data,
			function($val1,$val2) use($cols) {
				foreach ($cols as $col) {
					$parts=explode(' ',$col,2);
					$order=empty($parts[1])?
						SORT_ASC:
						constant($parts[1]);
					$col=$parts[0];
					if (!array_key_exists($col,$val1))
						$val1[$col]=NULL;
					if (!array_key_exists($col,$val2))
						$val2[$col]=NULL;
					list($v1,$v2)=[$val1[$col],$val2[$col]];
					if ($out=strnatcmp($v1,$v2)*
						(($order==SORT_ASC)*2-1))
						return $out;
				}
				return 0;
			}
		);
		return $data;
	}
protected function sort ( $ data , $ cond ) { $ cols = \ Base :: instance ( ) -> split ( $ cond ) ; uasort ( $ data , function ( $ val1 , $ val2 ) use ( $ cols ) { foreach ( $ cols as $ col ) { $ parts = explode ( ' ' , $ col , 2 ) ; $ order = empty ( $ parts [ 1 ] ) ? SORT_ASC : constant ( $ parts [ 1 ] ) ; $ col = $ parts [ 0 ] ; if ( ! array_key_exists ( $ col , $ val1 ) ) $ val1 [ $ col ] = NULL ; if ( ! array_key_exists ( $ col , $ val2 ) ) $ val2 [ $ col ] = NULL ; list ( $ v1 , $ v2 ) = [ $ val1 [ $ col ] , $ val2 [ $ col ] ] ; if ( $ out = strnatcmp ( $ v1 , $ v2 ) * ( ( $ order == SORT_ASC ) * 2 - 1 ) ) return $ out ; } return 0 ; } ) ; return $ data ; }
Sort a collection
@param $data
@param $cond
@return mixed
Sort a collection