priority

Getting best array value based on a priority list

I'll try and explain this the best I can. I have an array called $linkSets, and it has array entires that look like: <string>,<integer> <string>,<integer> <string>,<integer> I also have a priority list, that goes in this order: 22 -> 18 -> 35 -> 34. I would like to check each integer in the $linkSets array, and get the best <string> ...