note 125301 added to function.strrev
| From: | info at ensostudio dot ru | Date: | Tue, 25 Aug 2020 23:39:44 +0000 |
| Subject: | note 125301 added to function.strrev | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-215026@lists.php.net to get a copy of this message | ||
<?php
/**
* Reverse a miltibyte string.
*
* @param string $string The string to be reversed.
* @param string|null $encoding The character encoding. If it is omitted, the internal character
encoding value
* will be used.
* @return string The reversed string
*/
function mb_strrev(string $string, string $encoding = null): string
{
$chars = mb_str_split($string, 1, $encoding ?: mb_internal_encoding());
return implode('', array_reverse($chars));
}
?>
It's faster and flexible than tianyiw function (comment #122953)
----
Server IP: 45.112.84.4
Probable Submitter: 103.51.166.36 (proxied: 31.129.215.166)
----
Manual Page -- http://php.net/manual/en/function.strrev.php
Edit -- https://master.php.net/note/edit/125301
Del: integrated -- https://master.php.net/note/delete/125301/integrated
Del: useless -- https://master.php.net/note/delete/125301/useless
Del: bad code -- https://master.php.net/note/delete/125301/bad+code
Del: spam -- https://master.php.net/note/delete/125301/spam
Del: non-english -- https://master.php.net/note/delete/125301/non-english
Del: in docs -- https://master.php.net/note/delete/125301/in+docs
Del: other reasons-- https://master.php.net/note/delete/125301
Reject -- https://master.php.net/note/reject/125301
Search -- https://master.php.net/manage/user-notes.php