PHP 8.5.0 Alpha 2 available for testing

Voting

: max(four, two)?
(Example: nine)

The Note You're Voting On

smieat
15 years ago
perfect solutions for turkish utf-8 (including i I conversations):

<?php
function strtolowertr($metin){
return
mb_convert_case(str_replace('I','ı',$metin), MB_CASE_LOWER, "UTF-8");
}

function
strtouppertr($metin){
return
mb_convert_case(str_replace('i','İ',$metin), MB_CASE_UPPER, "UTF-8");
}

function
ucwordstr($metin) {
return
ltrim(mb_convert_case(str_replace(array(' I',' ı', ' İ', ' i'),array(' I',' I',' İ',' İ'),' '.$metin), MB_CASE_TITLE, "UTF-8"));
}

function
ucfirsttr($metin) {
$metin = in_array(crc32($metin[0]),array(1309403428, -797999993, 957143474)) ? array(strtouppertr(substr($metin,0,2)),substr($metin,2)) : array(strtouppertr($metin[0]),substr($metin,1));
return
$metin[0].$metin[1];
}
?>

<< Back to user notes page

To Top