Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:53449 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 97372 invoked from network); 20 Jun 2011 20:34:27 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Jun 2011 20:34:27 -0000 Authentication-Results: pb1.pair.com smtp.mail=johncrenshaw@priacta.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=johncrenshaw@priacta.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain priacta.com designates 64.95.72.238 as permitted sender) X-PHP-List-Original-Sender: johncrenshaw@priacta.com X-Host-Fingerprint: 64.95.72.238 mx1.myoutlookonline.com Received: from [64.95.72.238] ([64.95.72.238:62348] helo=mx1.myoutlookonline.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id EE/70-22948-538AFFD4 for ; Mon, 20 Jun 2011 16:06:13 -0400 Received: from mxout.myoutlookonline.com (localhost [127.0.0.1]) by mx1.myoutlookonline.com (Postfix) with ESMTP id C5DB0553E05; Mon, 20 Jun 2011 16:06:10 -0400 (EDT) X-Virus-Scanned: by SpamTitan at mail.lan Received: from HUB027.mail.lan (unknown [10.110.2.1]) by mx1.myoutlookonline.com (Postfix) with ESMTP id 0E43255452F; Mon, 20 Jun 2011 16:02:11 -0400 (EDT) Received: from MAILR001.mail.lan ([10.110.18.27]) by HUB027.mail.lan ([10.110.17.27]) with mapi; Mon, 20 Jun 2011 16:00:33 -0400 To: Anthony Ferrara , Stas Malyshev CC: Todd Ruth , "internals@lists.php.net" Date: Mon, 20 Jun 2011 16:01:30 -0400 Thread-Topic: [PHP-DEV] Re: foreach() for strings Thread-Index: Acwvb3vDHTGVKDPsQ/KdfR935N7zLQAFQvjA Message-ID: References: <1308584208.6296.9.camel@guybrush> <1308586150.6296.13.camel@guybrush> <1308589044.8394.27.camel@inspiron> <4DFF7E2A.50506@sugarcrm.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: RE: [PHP-DEV] Re: foreach() for strings From: johncrenshaw@priacta.com (John Crenshaw) > -----Original Message----- > From: Anthony Ferrara [mailto:ircmaxell@gmail.com]=20 >=20 > > text_to_array($s) =3D=3D str_split($s, 1) >=20 > No, because str_split always splits into 1 byte chunks. text_to_array > would take the character set into account (or that's where the utility > in it would be)... I think this does what you want: function utf8_str_split($s) { return preg_split("/(.)/u", $s, null, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLI= T_NO_EMPTY); } John Crenshaw Priacta, Inc.