Skip to content

Instantly share code, notes, and snippets.

@alpenzoo
Last active March 6, 2020 08:20
Show Gist options
  • Save alpenzoo/05204fe22e9ba228fe2d05dc2b056b77 to your computer and use it in GitHub Desktop.
Save alpenzoo/05204fe22e9ba228fe2d05dc2b056b77 to your computer and use it in GitHub Desktop.
php upper lower for standard en chars
<?php
setlocale(LC_CTYPE, 'de_DE.UTF8');
function myUpper($char){
$lo = ord($char);
$up = $lo & 0x5f;
return $up;
}
function myLower($char){
$up = ord($char);
$lo = $up ^ 0x20;
return $lo;
}
echo chr(myUpper('h'));
echo strtoupper('ô');
echo mb_convert_case('ô', MB_CASE_UPPER, "UTF-8");
// see also https://gitlab.snuipp.fr/snusoft/api_carte_scolaire/blob/master/vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment