note 110598 added to transliterator.transliterate
| From: | hdogan at gmail dot com | Date: | Sun, 11 Nov 2012 14:33:17 +0000 |
| Subject: | note 110598 added to transliterator.transliterate | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-191866@lists.php.net to get a copy of this message | ||
You can create slugs easily with:
<?php
function slugify($string) {
$string = transliterator_transliterate("Any-Latin; NFD; [:Nonspacing Mark:] Remove; NFC;
[:Punctuation:] Remove; Lower();", $string);
$string = preg_replace('/[-\s]+/', '-', $string);
return trim($string, '-');
}
echo slugify("Я лÑÐ±Ð»Ñ PHP!");
?>
----
Server IP: 69.147.83.199
Probable Submitter: 88.247.5.209
----
Manual Page -- http://www.php.net/manual/en/transliterator.transliterate.php
Edit -- https://master.php.net/note/edit/110598
Del: integrated -- https://master.php.net/note/delete/110598/integrated
Del: useless -- https://master.php.net/note/delete/110598/useless
Del: bad code -- https://master.php.net/note/delete/110598/bad+code
Del: spam -- https://master.php.net/note/delete/110598/spam
Del: non-english -- https://master.php.net/note/delete/110598/non-english
Del: in docs -- https://master.php.net/note/delete/110598/in+docs
Del: other reasons-- https://master.php.net/note/delete/110598
Reject -- https://master.php.net/note/reject/110598
Search -- https://master.php.net/manage/user-notes.php