I am trying to re-arrange a multi-dimensional array based on custom arranged key as I am using jQuery sortable plugin. I read usort, ksort and other but those are sorting in descending or ascending order but on custom arranged key. I read uasort bu I don't understand how to implement with this.
$original_array =
array(
'one' => array
(
'url' => 'home.php',
'title' => 'Home',
'permission' => array
(
'administrator' => yes,
'manager' => yes
)
),
'two' => array
(
'url' => 'entries.php',
'title' => 'Entries',
'permission' => array
(
'administrator' => yes,
'manager' => yes,
)
),
'three' => array
(
'url' => 'stock.php',
'title' => 'Stock',
'permission' => array
(
'administrator' => 'yes',
'manager' => 'yes',
)
),
'four' => array
(
'url' => 'products.php',
'title' => 'Products',
'permission' => array
(
'administrator' => yes,
'manager' => yes,
)
),
'five' => array
(
'url' => 'prices.php',
'title' => 'Prices',
'permission' => array
(
'administrator' => yes,
'manager' => yes,
)
),
);
array to be arranged like in this order
$custom_array_to_be_arranged =
array(
'three' => array
(
'url' => 'stock.php',
'title' => 'Stock',
'permission' => array
(
'administrator' => 'yes',
'manager' => 'yes',
)
),
'one' => array
(
'url' => 'home.php',
'title' => 'Home',
'permission' => array
(
'administrator' => yes,
'manager' => yes
)
),
'five' => array
(
'url' => 'prices.php',
'title' => 'Prices',
'permission' => array
(
'administrator' => yes,
'manager' => yes,
)
),
'two' => array
(
'url' => 'entries.php',
'title' => 'Entries',
'permission' => array
(
'administrator' => yes,
'manager' => yes,
)
),
'four' => array
(
'url' => 'products.php',
'title' => 'Products',
'permission' => array
(
'administrator' => yes,
'manager' => yes,
)
)
);
Any help would be appreciated. Thanks.