-2

Supposing you have an object:

$arr = array(
   array('name' => 'toto', 'firstname' => 'abc'),
   array('name' => 'toto2', 'firstname' => 'aaa')
);

I want to order it by name AND firstname. You cannot use keyword "use" for old version of php like 5.2. If a general function is not possible, then build a function for this specific case.

Thanks.

Thanh Trung
  • 3,566
  • 3
  • 31
  • 42
  • 1
    how to to do sorts has been answered multiple times before. See the related section to the right please. Also, StackOverflow is not a site to request people to write code for you. – Gordon Jan 09 '12 at 09:53

1 Answers1

0

Use usort with a callback that compares the elements of the array according to the rules you specify in the callback.

GordonM
  • 31,179
  • 15
  • 87
  • 129