I want to sort on field banner_id (int). But when running I get a strange result.
The result of this usort() is following:
101 - 204- 34 - 45 - 69 - etc.
I must get:
34 - 45 -69 - 101 - 204
function usort_reorder($a,$b){
$orderby = (!empty($_REQUEST['orderby'])) ? $_REQUEST['orderby'] : 'banner_id';
$order = (!empty($_REQUEST['order'])) ? $_REQUEST['order'] : 'asc';
$result = strcmp($a[$orderby], $b[$orderby]);
return ($order==='asc') ? $result : -$result;
}
usort($data, 'usort_reorder');
What to do to get this sort correct running. Means not only sorting the first digit but the whole digit. Now it only takes the first one.