Voting

: min(seven, nine)?
(Example: nine)

The Note You're Voting On

j-fr dot fortier at wanadoo dot fr
6 years ago
Since PHP 5.4, to make uppercase ou lowercase characters, or rewrite some uris, without to take care about initial encoding, the transliteration is easier (and probably the best way): see http://php.net/manual/fr/transliterator.transliterate.php and http://userguide.icu-project.org/transforms/general

For example (with create) (french text: replace all accuentued -éèàîïùç...- chars with ascii chars):
<?php
$transliterator
= Transliterator::create("NFD; [:Nonspacing Mark:] Remove; NFC;");
echo
$transliterator->transliterate("Héhé, ça marche !");
?>
// Result: « Hehe, ca marche ! »

To rewrite a phrase in URI (with createFromRules):
<?php
$transliterator
= Transliterator::createFromRules("::Latin-ASCII; ::Lower; [^[:L:][:N:]]+ > '-';");
echo
trim($transliterator->transliterate("Héhé, ça marche !"), '-');
?>
// Result : « hehe-ca-marche »

<< Back to user notes page

To Top