I want to sort the following array by multiple keys in the following order: First by "type", then "product", and lastly by "name". This is pretty easily done with usort, although my clients wants "product" sorted in a specific order: Stapler, Binder, Book.
$arr = array(
array(
'type' => 'School',
'product' => 'Book',
'name' => 'My book',
'data' => '...'
),
array(
'type' => 'Job',
'product' => 'Stapler',
'name' => 'My stapler',
'data' => '...'
),
array(
'type' => 'Personal',
'product' => 'Binder',
'name' => 'My binder',
'data' => '...'
),
array(
'type' => 'School',
'product' => 'Book',
'name' => 'My book',
'data' => '...'
)
);
Does anyone know a clever way to accomplish this?