note 95191 deleted from function.mb-split by danbrown

From: Date: Thu, 17 Dec 2009 15:46:05 +0000
Subject: note 95191 deleted from function.mb-split by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-164088@lists.php.net to get a copy of this message
Note Submitter: mt at mediamedics dot nl ---- My version of gert's multibyte mbStringToArray() function with the ability to specify your own split_length instead of 1 (like the original str_split function): <?php function mb_str_split($string, $split_length){ mb_internal_encoding( 'UTF-8'); mb_regex_encoding( 'UTF-8'); $mb_strlen = mb_strlen($string, 'utf-8'); if($mb_strlen > $split_length){ $array = array(); for($idx = 0; $idx < $mb_strlen; $idx + $split_length){ $array[] = mb_substr($string, $idx, $split_length); } return $array; }else{ return $string; } } ?>

« previous php.notes (#164088) next »