Location: PHPKode > scripts > EZ Framework > ez-framework/ex_sorting.php
# Version 1.0

$a = array('a','a','a','b','b','u','k','b','a','d');
$b = array('a','a','a','g','b','a','gh','d','a','s');
$c = array('moike','baob','aaspen','bmobby','anne','erin','oden','boy','arial','yolanda');

	$ar[$i]['one'] = $a[$i];
	$ar[$i]['two'] = $b[$i];
	$ar[$i]['three'] = $c[$i];
// Single Dem. Array
$ar = array('a','a','c','c','e','a','aa','a1','2a','2a');

// Create sorting object, send in (type of sort, and sort flags) both optional
// ($the array,which keys to sort by - can send in multiple keys to sort by,
// the order of the sort will be from left to right
$sorting = new sorting();

foreach($sorting->sort_list($ar,'one','two') as $a)
	echo "$a[one]-$a[two]<br>";
echo '<br>';

// Reverse the current sort method

//foreach($sorting->sort_list($ar,'one','two') as $a)echo "$a[one]-$a[two]<br>";echo '<br>';
$t = $sorting->sort_list($ar,'two','one');

foreach($t as $a)
	echo "$a[one]-$a[two]<br>";
echo '<br>';

// Reverse the current sort method

foreach($sorting->sort_list($ar,'one','two','three') as $a)
	echo "$a[one]-$a[two]-$a[three]<br>";
echo '<br>';

// Set the current sort method
$sorting->sort_by = 'arsort';

foreach($sorting->sort_list($ar,'two','one') as $a)
	echo "$a[one]-$a[two]<br>";
echo '<br>';
Return current item: EZ Framework