I needed to merge and then sort two arrays with dissimilar data structures (can't be sorted in the MySQL query) but where both had a `created_on` field.

So I am using `usort()` with a custom function.

**In my controller**

```
usort(merged_array, 'sort_records');

```

**In my helper functions**

```
if(!function_exists('sort_records')){
  function sort_records($a,$b){
    if ( $a['created_at'] == $b['created_at'] )
      return 0;
    if ( $a['created_at'] < $b['created_at'] )
       return -1;
    return 1;
  } 
}

```

I would like to make this `sort_records()` function reusable. So I can use it with other arrays. Maybe something like..

```
function sort_records($a,$b,$index){
  if ( $a[$index] == $b[$index] )
     return 0;
  if ( $a[$index] < $b[$index] )
     return -1;
  return 1;

```

Is this possible with `usort()` since when you call the function it does not take parameters at all? Is there another option?