Instagram Hesabımız Mesaj Gönder
Mesaj Gönder Instagram Hesabımız
X
X

  CHARK ACTIVE! Only valid on "SCRIPT & THEMES" discount coupon code now "(LUCKY WHEEL)" spin & win : CLICK & SPIN THE WHEEL

WhatsApp  Pre-Sales

When we want to sort directories in php by letter order, the letters with Turkish characters break the order. In php, you can use the function below to sort the array (array) according to the Turkish letter order.


function customSort($a, $b) {
static $charOrder = array('a', 'b', 'c', 'c', 'd', 'e', 'f', 'g', 'g', 'h', 'I', 'I', 'j', 'k', 'l', 'm', 'n', 'o', 'o', 'p', 'r', 's', 'S','t', 'u', 'u', 'v', 'y', 'z');

$a = mb_strtolower($a);
$b = mb_strtolower($b);

for($i=0;$i$valB) return 1;
return -1;
}

if(mb_strlen($a) == mb_strlen($b)) return 0;
if(mb_strlen($a) > mb_strlen($b)) return -1;
return 1;

}
$array = array('ceyhan','şanlıurfa','özkan','ismail','adana');
usort($array, 'customSort');

print_r($array);

//OUTPUT
//Array ( [0] => adana [1] => ceyhan [2] => ismail [3] => ozkan [4] => sanliurfa )

Login Sign Up
Top