In a blank app, I have defined a function called ‘cmp’ taking 2 parameters. I call this function like this: [SIZE=14px]
usort($fruits,“cmp”);
[/SIZE]
but it gives error:
Error usort() expects parameter 2 to be a valid callback, function 'cmp' not found or invalid function name
This works fine in normal php outside of scriptcase.
How can I fix this?
(I’m simply trying to sort a multi-dimensional array by values in a key field. usort documentation is at http://php.net/manual/en/function.usort.php)