lib/db/cortex.php
public function orderBy($cond) {
		$cols=\Base::instance()->split($cond);
		$this->uasort(function($val1,$val2) use($cols) {
			foreach ($cols as $col) {
				$parts=explode(' ',$col,2);
				$order=empty($parts[1])?'ASC':$parts[1];
				$col=$parts[0];
				list($v1,$v2)=array($val1[$col],$val2[$col]);
				if ($out=strnatcmp($v1,$v2)*
					((strtoupper($order)=='ASC')*2-1))
					return $out;
			}
			return 0;
		});
	}
public function orderBy($cond) {
		$cols=\Base::instance()->split($cond);
		$this->uasort(function($val1,$val2) use($cols) {
			foreach ($cols as $col) {
				$parts=explode(' ',$col,2);
				$order=empty($parts[1])?'ASC':$parts[1];
				$col=$parts[0];
				list($v1,$v2)=array($val1[$col],$val2[$col]);
				if ($out=strnatcmp($v1,$v2)*
					((strtoupper($order)=='ASC')*2-1))
					return $out;
			}
			return 0;
		});
	}
public function orderBy ( $ cond ) { $ cols = \ Base :: instance ( ) -> split ( $ cond ) ; $ this -> uasort ( function ( $ val1 , $ val2 ) use ( $ cols ) { foreach ( $ cols as $ col ) { $ parts = explode ( ' ' , $ col , 2 ) ; $ order = empty ( $ parts [ 1 ] ) ? 'ASC' : $ parts [ 1 ] ; $ col = $ parts [ 0 ] ; list ( $ v1 , $ v2 ) = array ( $ val1 [ $ col ] , $ val2 [ $ col ] ) ; if ( $ out = strnatcmp ( $ v1 , $ v2 ) * ( ( strtoupper ( $ order ) == 'ASC' ) * 2 - 1 ) ) return $ out ; } return 0 ; } ) ; }
re-assort the current collection using a sql-like syntax
@param $cond
re - assort the current collection using a sql - like syntax