0

I have an array $list that I'm trying to sort. I'm using a function that does that like so:

function sortNodes($a, $b) {
    return strcmp($a->$title, $b->$title);
}
usort($list, 'sortNodes');

but I need to pass an extra parameter to that function. Something like:

function sortNodes($a, $b, $node) {
   return strcmp($a->$node, $b->$node);
}
usort($list, 'sortNodes');

The $node parameter needs be fetch from URL with $_GET but this way it isn't functioning. How can i do this?

thanks in advance.

Sofyan Thayf
  • 1,322
  • 2
  • 14
  • 26
eskimopest
  • 401
  • 3
  • 18

0 Answers0