note 107878 added to function.mb-substr
| From: | santiago-php at zarate dot net dot ve | Date: | Mon, 12 Mar 2012 20:57:26 +0000 |
| Subject: | note 107878 added to function.mb-substr | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-186615@lists.php.net to get a copy of this message | ||
@qeremy
Actually you could just add the encoding you desire, and it would work perfectly (i.e: Give the same
results as your approach)
<?php
$str = "Büyük";
print mb_substr($str, 0, 3); //Bü
print mb_substr($str, 0, 3, 'UTF-8'); //Büy
print substr_unicode($str, 3); //Büy
?>
----
Server IP: 69.147.83.197
Probable Submitter: 190.141.76.78
----
Manual Page -- http://www.php.net/manual/en/function.mb-substr.php
Edit -- https://master.php.net/note/edit/107878
Del: integrated -- https://master.php.net/note/delete/107878/integrated
Del: useless -- https://master.php.net/note/delete/107878/useless
Del: bad code -- https://master.php.net/note/delete/107878/bad+code
Del: spam -- https://master.php.net/note/delete/107878/spam
Del: non-english -- https://master.php.net/note/delete/107878/non-english
Del: in docs -- https://master.php.net/note/delete/107878/in+docs
Del: other reasons-- https://master.php.net/note/delete/107878
Reject -- https://master.php.net/note/reject/107878
Search -- https://master.php.net/manage/user-notes.php