Re: Re: foreach() for strings
| From: | Anthony Ferrara | Date: | Mon, 20 Jun 2011 17:28:13 +0000 |
| Subject: | Re: Re: foreach() for strings | ||
| References: | 1 2 3 4 5 6 7 8 9 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-53438@lists.php.net to get a copy of this message | ||
> text_to_array($s) == str_split($s, 1)
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)...
On Mon, Jun 20, 2011 at 1:06 PM, Stas Malyshev <smalyshev@sugarcrm.com> wrote:
> Hi!
>
> On 6/20/11 9:57 AM, Todd Ruth wrote:
>>
>> Iterators are nice. Having a "text_string_to_array" function
>> would also be fine. For example:
>>
>> $s = 'hello';
>> foreach (text_string_to_array($s) as $x) {
>> var_dump($x);
>> }
>
>
> text_to_array($s) == str_split($s, 1)
>
> --
> Stanislav Malyshev, Software Architect
> SugarCRM: http://www.sugarcrm.com/
> (408)454-6900 ext. 227
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>