Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:53397 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 50880 invoked from network); 20 Jun 2011 12:16:04 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Jun 2011 12:16:04 -0000 Authentication-Results: pb1.pair.com header.from=pierre.php@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=pierre.php@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.170 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: pierre.php@gmail.com X-Host-Fingerprint: 209.85.220.170 mail-vx0-f170.google.com Received: from [209.85.220.170] ([209.85.220.170:32814] helo=mail-vx0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D0/6D-34681-20A3FFD4 for ; Mon, 20 Jun 2011 08:16:03 -0400 Received: by vxi39 with SMTP id 39so866912vxi.29 for ; Mon, 20 Jun 2011 05:15:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=+GhR6VFtdCMmZ6j7dbaJoShS8lYVbEtr6yUciHixYMQ=; b=GHSpkm97+EBaZgDZ1iCRFPhiQrhdLSqqQ9+ZfP3++PMv9Svch0voi1wmWjWVbsXwls jTUybL3QkgF71+0Aeov6lGog3PWFjikRQluYeTI+AAok9mSkXcM7C2S4TCSMkSwcdOal PHkOraI3KY+6bTB0Jhf2Gi13bxG3j2eOTTmes= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=AINKCan816ODh8PiXjMTlKQjW2BqOjmQ+y3GjjM8IxzPHIlkczy5x1bIRZEhVadRLk p5yl08w/HW8AWxVqEvtCPbydP/t/S6Dr2ZYYKM09CXPp+XKQ1Os01w1iiVcGLK9Sqfrh AnSKELDtap+NjpzWtfV0uggcP0G0JwAUf2s8Y= MIME-Version: 1.0 Received: by 10.52.65.169 with SMTP id y9mr141756vds.64.1308571763956; Mon, 20 Jun 2011 05:09:23 -0700 (PDT) Received: by 10.52.160.33 with HTTP; Mon, 20 Jun 2011 05:09:23 -0700 (PDT) In-Reply-To: <1308570997.3172.21.camel@guybrush> References: <1308570997.3172.21.camel@guybrush> Date: Mon, 20 Jun 2011 14:09:23 +0200 Message-ID: To: =?ISO-8859-1?Q?Johannes_Schl=FCter?= Cc: Robert Eisele , internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] foreach() for strings From: pierre.php@gmail.com (Pierre Joye) 2011/6/20 Johannes Schl=FCter : > On Mon, 2011-06-20 at 13:27 +0200, Robert Eisele wrote: >> foreach() has many functions, looping over arrays, objects and implement= ing >> the iterator interface. I think it's also quite intuitive to use foreach= () >> for strings, too. > > I would prefer a TextIterator as we had in the old PHP 6 as this allows > more powerful filtering etc. using iterator semantics even though this > might be a bit slower. A foreach with string should be seen as binary buffer, with no clue about its content and only to fetch it byte by byte. TextIterator can be smarter and support unicode when ICU is available. Cheers, --=20 Pierre @pierrejoye | http://blog.thepimp.net | http://www.libgd.org