note 121877 added to function.mb-strcut

From: Date: Thu, 16 Nov 2017 14:30:21 +0000
Subject: note 121877 added to function.mb-strcut
Groups: php.notes 
Request: Send a blank email to php-notes+get-209164@lists.php.net to get a copy of this message
Here is an example with UTF8 characters, to see how the start and length arguments are working: $str_utf8 = utf8_encode("Déjà_vu"); $str_utf8_0 = mb_strcut($str_utf8, 0, 4, "UTF-8"); // Déj $str_utf8_1 = mb_strcut($str_utf8, 1, 4, "UTF-8"); // éj $str_utf8_2 = mb_strcut($str_utf8, 2, 4, "UTF-8"); // éj $str_utf8_3 = mb_strcut($str_utf8, 3, 4, "UTF-8"); // jà_ $str_utf8_4 = mb_strcut($str_utf8, 4, 4, "UTF-8"); // à_v The string includes two special charaters, "é" and "à" internally coded with two bytes. Note that a multibyte character is removed rather than kept in half at the end of the output. Note also that the result is the same for a cut 1,4 and a cut 2,4 with this string. ---- Server IP: 195.221.21.36 Probable Submitter: 2a01:e34:ee76:b210:e581:69a1:3806:45d4 ---- Manual Page -- http://php.net/manual/en/function.mb-strcut.php Edit -- https://master.php.net/note/edit/121877 Del: integrated -- https://master.php.net/note/delete/121877/integrated Del: useless -- https://master.php.net/note/delete/121877/useless Del: bad code -- https://master.php.net/note/delete/121877/bad+code Del: spam -- https://master.php.net/note/delete/121877/spam Del: non-english -- https://master.php.net/note/delete/121877/non-english Del: in docs -- https://master.php.net/note/delete/121877/in+docs Del: other reasons-- https://master.php.net/note/delete/121877 Reject -- https://master.php.net/note/reject/121877 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#209164) next »