Created
February 18, 2017 15:00
-
-
Save Kcko/36a8249146041def4aee95c96b293ce3 to your computer and use it in GitHub Desktop.
czech sort in array
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function SortCzechChars($a, $b){ | |
static $czechCharsS = array('Á', 'Č', 'Ď', 'É', 'Ě' , 'Ch' , 'Í', 'Ň', 'Ó', 'Ř', 'Š', 'Ť', 'Ú', 'Ů' , 'Ý', 'Ž', 'á', 'č', 'ď', 'é', 'ě' , 'ch' , 'í', 'ň', 'ó', 'ř', 'š', 'ť', 'ú', 'ů' , 'ý', 'ž'); | |
static $czechCharsR = array('AZ','CZ','DZ','EZ','EZZ','HZZZ','IZ','NZ','OZ','RZ','SZ','TZ','UZ','UZZ','YZ','ZZ','az','cz','dz','ez','ezz','hzzz','iz','nz','oz','rz','sz','tz','uz','uzz','yz','zz'); | |
$A = str_replace($czechCharsS, $czechCharsR, $a); | |
$B = str_replace($czechCharsS, $czechCharsR, $b); | |
return strnatcasecmp($A, $B); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment