PHP 8.5.0 Alpha 2 available for testing

Voting

: five minus five?
(Example: nine)

The Note You're Voting On

mt at mediamedics dot nl
15 years ago
A multibyte one-to-one alternative for the str_split function (http://php.net/manual/en/function.str-split.php):

<?php
function mb_str_split($string, $split_length = 1){

mb_internal_encoding('UTF-8');
mb_regex_encoding('UTF-8');

$split_length = ($split_length <= 0) ? 1 : $split_length;

$mb_strlen = mb_strlen($string, 'utf-8');

$array = array();

for(
$i = 0; $i < $mb_strlen; $i + $split_length){

$array[] = mb_substr($string, $i, $split_length);
}

return
$array;

}
?>

<< Back to user notes page

To Top