alright, I’m trying something which should be like really easy.
Here it is:
usort($newarr, "cmp");
function cmp($a, $b)
{ return 0; }
The problem is simple: it does not sort the array by giving this warning message
Warning: usort() expects parameter 2 to be a valid callback, function 'cmp' not found or invalid function name
I have read this answer here PHP usort won't sort
but it just doesn’t make any sense to me, I do not have a class like how it is explained in the answer 1 (and I don’t even need any, i tried with $this, this, insted of “myclass” but it’s simply not working any):
usort($items, array("MyClass", "compare_method"));
Change the script flow, by the time you are trying to sort your array
cmpdoes not exists yet. So, this should work: