note 105022 added to ref.mbstring

From: Date: Fri, 22 Jul 2011 14:48:29 +0000
Subject: note 105022 added to ref.mbstring
Groups: php.notes 
Request: Send a blank email to php-notes+get-181786@lists.php.net to get a copy of this message
The mb_str_split below has some errors, here I fixed them and also added a shortcut when the length is less than the split length: 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' ); if( $mb_strlen <= $split_length ) { return array( $string ); } $array = array( ); for( $i = 0; $i < $mb_strlen; $i = $i + $split_length ) { $array[] = mb_substr( $string, $i, $split_length ); } return $array; } ---- Server IP: 69.147.83.197 Probable Submitter: 200.123.146.83 ---- Manual Page -- http://www.php.net/manual/en/ref.mbstring.php Edit -- https://master.php.net/note/edit/105022 Del: integrated -- https://master.php.net/note/delete/105022/integrated Del: useless -- https://master.php.net/note/delete/105022/useless Del: bad code -- https://master.php.net/note/delete/105022/bad+code Del: spam -- https://master.php.net/note/delete/105022/spam Del: non-english -- https://master.php.net/note/delete/105022/non-english Del: in docs -- https://master.php.net/note/delete/105022/in+docs Del: other reasons-- https://master.php.net/note/delete/105022 Reject -- https://master.php.net/note/reject/105022 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#181786) next »