User sort with high priority of concrete value
问题 I am trying to implement a function that will sort an array of strings in lexical order (case-insensitive). But with one exception: if the string is equal to, let's say, "bingo!" put this line on top. I made some function which works well on the given test data. But I'm not sure I don't fool myself with special case. Please check me. <?php $a = [ 'alfa', 'beta', 'gama', 'sigma', 'foo', 'bar', 'bingo!', ]; usort($a, function ($a, $b) { $cmp = strcasecmp($a, $b); return $cmp == 0 ? 0 :