Skip to content

Instantly share code, notes, and snippets.

@Shadow6363
Created September 27, 2012 17:05
Show Gist options
  • Save Shadow6363/3795160 to your computer and use it in GitHub Desktop.
Save Shadow6363/3795160 to your computer and use it in GitHub Desktop.
<?php
function sortRoomNumberList($a, $b) {
$diffIndex = strspn($a ^ $b, "\0");
if(strlen($a) > $diffIndex && strlen($b) > $diffIndex) {
if($a[$diffIndex] == 'G' && $b[$diffIndex] != 'G') {
return -1;
} elseif($a[$diffIndex] != 'G' && $b[$diffIndex] == 'G') {
return 1;
}
} return ($a < $b) ? -1 : 1;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment