note 92665 added to function.mb-split

From: Date: Mon, 03 Aug 2009 10:34:58 +0000
Subject: note 92665 added to function.mb-split
Groups: php.notes 
Request: Send a blank email to php-notes+get-159025@lists.php.net to get a copy of this message
We are talking about Multi Byte ( e.g. UTF-8) strings here, so preg_split will fail for the following string: 'Weiße Rosen sind nicht grün!' And because I didn't find a regex to simulate a str_split I optimized the first solution from adjwilli a bit: <?php $string = 'Weiße Rosen sind nicht grün!' $stop = mb_strlen( $string); $result = array(); for( $idx = 0; $idx < $stop; $idx++) { $result[] = mb_substr( $string, $idx, 1); } ?> Let me know, if someone found a regex to simulate a str_split with mb_split. ---- Server IP: 212.124.37.9 Probable Submitter: 62.159.240.138 ---- Manual Page -- http://www.php.net/manual/en/function.mb-split.php Edit -- https://master.php.net/note/edit/92665 Del: integrated -- https://master.php.net/note/delete/92665/integrated Del: useless -- https://master.php.net/note/delete/92665/useless Del: bad code -- https://master.php.net/note/delete/92665/bad+code Del: spam -- https://master.php.net/note/delete/92665/spam Del: non-english -- https://master.php.net/note/delete/92665/non-english Del: in docs -- https://master.php.net/note/delete/92665/in+docs Del: other reasons-- https://master.php.net/note/delete/92665 Reject -- https://master.php.net/note/reject/92665 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#159025) next »