Sort Process
Comparative function
name | income |
John |
$50,000 |
Marry |
$60,000 |
Peter |
$100,000 |
Donald |
$80,000 |
->pipe(new Sort(array(
"income"=>function($a, $b) {
if ($a < $b) return 1;
else if ($a === $b) return 0;
else if ($a > $b) return -1;
}
)))
name | income |
Peter |
$100,000 |
Donald |
$80,000 |
Marry |
$60,000 |
John |
$50,000 |
The example demonstrates usage of `Sort` process. The sort process is used to sort data according to a comparative function.
__Sort using comparative function__
```
"income"=>function($a, $b) {
if ($a < $b) return 1;
else if ($a === $b) return 0;
else if ($a > $b) return -1;
}
```