PHP 8.5.0 Alpha 4 available for testing

Voting

: two plus one?
(Example: nine)

The Note You're Voting On

info at ensostudio dot ru
4 years ago
<?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)

<< Back to user notes page

To Top