How can I sort an array based on another array? I'm speaking about the values, not the keys. I've found plenty of questions about how to sort the keys but none about the values.
Imagine I have this array :
$sizes = array("L", "XXXL", "M", "S");
How can I reorder these to be like this :
$newsizes = array("S", "M", "L", "XXXL");
based on a fixed human logical array like this one :
$sizeincrement = array("XS", "S", "M", "L", "XL", "XXL", "XXXL");
And considering elements that are not in the sizeincrement array should be appended at the end.
I thought this would exists as a ready-made sort function, but it appears it's not the case: PHP SORTING