Location: PHPKode > scripts > DataComparison > datacomparison/example.php
<?php
include('./DataComparison.php');

$array = array(
	array('id' => 1, 'title' => 'Hello'),
	array('id' => 2, 'title' => 'Banana'),
	array('id' => 3, 'title' => 'Banana'),
	array('id' => 4, 'title' => 'Apple'),
	array('id' => 5, 'title' => 'Pineapple'),
);

echo '<h2>Original Data</h2>';
foreach($array as $v)
	echo '#'.$v['id'].' - '.$v['title'].'<br/>';

uasort($array, array(new DataComparison('title'), 'sort'));

echo '<h2>Data sorted by title</h2>';
foreach($array as $v)
	echo '#'.$v['id'].' - '.$v['title'].'<br/>';
Return current item: DataComparison