i need to implement some specfic sorting algorithm. I have two arrays:
$items = array(
array("id" => "…", "type" => "alpha"),
array("id" => "…", "type" => "beta"),
array("id" => "…", "type" => "company"),
array("id" => "…", "type" => "marketing"),
array("id" => "…", "type" => "beta"),
array("id" => "…", "type" => "company"),
array("id" => "…", "type" => "alpha"),
array("id" => "…", "type" => "alpha"),
array("id" => "…", "type" => "company"),
array("id" => "…", "type" => "marketing"),
[…]
);
$order = array("company", "marketing", "alpha", "beta" );
As you propably can imagine i need to sort $items according to the order specified in $order.
You can sort with a custom comparison function using
usort