I have an array that is populated with 4 alphabetical letters from 'A' to 'Z'. I'm trying to find the lowest value where 'Z' is the lowest and 'A' the highest (like a grading system). For example:
$abc = ['A', 'G', 'Y', 'B'];
In this case Y is the lowest grade, but obviously min()
and max()
won't work since they give me the opposite of what I'm looking for. Is there a way to do it in PHP without writing my own function?