How to sort an array of Roman numerals?
问题 I have an array containing Roman numerals (as strings of course). Like this: $a = array('XIX', 'LII', 'V', 'MCCXCIV', 'III', 'XIII'); I'd like to sort them according to the numeric values of these numerals, so the results should be something like: $sorted_a = array('III', 'V', 'XIII', 'XIX', 'LII', 'MCCXCIV'); So my question is: what is the best way to sort an array of Roman numerals? I know how to use the array sorting functions of PHP, I'm interested in the logic that goes on inside the