Does PHP have the capability to sort an array of items (A) in an order that is defined by another array (B)? Eg. the item that comes first in B decides which item should come first when sorting A.
$order_to_sort_by = array("Gold", "Silver", "Bronze");
$items_to_sort = array("Bronze", "Silver", "Bronze", "Gold", "Bronze", "Silver");
some_sort_function($items_to_sort, $order_to_sort_by);
Result:
Gold
Silver
Silver
Bronze
Bronze
Bronze
EDIT: The duplicate that was suggested seems to use keys of another array to determine which keys in the array should be used for sorting. Somewhat unclear, but I don't think it's a duplicate.