note 83331 added to function.str-split

From: Date: Wed, 21 May 2008 10:20:22 +0000
Subject: note 83331 added to function.str-split
Groups: php.notes 
Request: Send a blank email to php-notes+get-139576@lists.php.net to get a copy of this message
This function supportes utf8 (improvement of function str_split_php4) i tried this function successfully with these languages 1- Chinese 2- Japanese 3- Arabic 4- Turkish 5- Urdu 6- Russian 7- Persian function str_split_php4_utf8($str) { // place each character of the string into and array $split=1; $array = array(); for ( $i=0; $i < strlen( $str ); ){ $value = ord($str[$i]); if($value > 127){ if($value >= 192 && $value <= 223) $split=2; elseif($value >= 224 && $value <= 239) $split=3; elseif($value >= 240 && $value <= 247) $split=4; }else{ $split=1; } $key = NULL; for ( $j = 0; $j < $split; $j++, $i++ ) { $key .= $str[$i]; } array_push( $array, $key ); } return $array; } ---- Server IP: 69.147.83.197 Probable Submitter: 212.116.209.117 ---- Manual Page -- http://www.php.net/manual/en/function.str-split.php Edit -- https://master.php.net/note/edit/83331 Del: integrated -- https://master.php.net/note/delete/83331/integrated Del: useless -- https://master.php.net/note/delete/83331/useless Del: bad code -- https://master.php.net/note/delete/83331/bad+code Del: spam -- https://master.php.net/note/delete/83331/spam Del: non-english -- https://master.php.net/note/delete/83331/non-english Del: in docs -- https://master.php.net/note/delete/83331/in+docs Del: other reasons-- https://master.php.net/note/delete/83331 Reject -- https://master.php.net/note/reject/83331 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#139576) next »