Re: [PHP-DEV] deprecation status of $str{42} versus $str[42], revisited

2010-09-23 Thread Peter Cowburn
On 22 September 2010 22:34, Philip Olson phi...@roshambo.org wrote: Greetings geeks, This topic still lacks a defined conclusion. There are several rumors that something was decided, but I can't confirm this without archived proof. Here's the code:  $str = I am an array of characters, but

[PHP-DEV] deprecation status of $str{42} versus $str[42], revisited

2010-09-22 Thread Philip Olson
Greetings geeks, This topic still lacks a defined conclusion. There are several rumors that something was decided, but I can't confirm this without archived proof. Here's the code: $str = I am an array of characters, but still a string.; echo $str[3]; // Documented as correct since 2006

Re: [PHP-DEV] deprecation status of $str{42} versus $str[42], revisited

2010-09-22 Thread Chris Stockton
Hello, On Wed, Sep 22, 2010 at 2:34 PM, Philip Olson phi...@roshambo.org wrote: Greetings geeks, Also, Andi mentioned[1] the possibility of optimizing {} for string use (the original intent) in which case keeping {} would be wise. It was over two years ago I commented on my interest in

Fwd: [PHP-DEV] deprecation status of $str{42} versus $str[42], revisited

2010-09-22 Thread Victor Bolshov
-- Пересланное сообщение -- От кого: Victor Bolshov crocodil...@gmail.com Дата: 23 сентября 2010 г. 8:48 Тема: Re: [PHP-DEV] deprecation status of $str{42} versus $str[42], revisited Кому: Chris Stockton chrisstockto...@gmail.com Personally, I use the syntax $str{1} since long

Re: [PHP-DEV] deprecation status of $str{42} versus $str[42]

2008-06-19 Thread Andrei Zmievski
That's why there is TextIterator. And it's also much faster (in PHP 6) than iterating through string using indexes. -Andrei Stefan Walk wrote: On Tuesday 17 June 2008 08:27:37 Arvids Godjuks wrote: 2008/6/16 Edward Z. Yang [EMAIL PROTECTED]: PHP userland code may not treat strings as first

Re: [PHP-DEV] deprecation status of $str{42} versus $str[42]

2008-06-18 Thread Andrei Zmievski
Maybe TextIterator can be backported from HEAD, because it allows for just that. foreach (new TextIterator($str) as $c) { ... } Arvids Godjuks wrote: 2008/6/16 Edward Z. Yang [EMAIL PROTECTED]: PHP userland code may not treat strings as first class arrays, but that's certainly how they

Re: [PHP-DEV] deprecation status of $str{42} versus $str[42]

2008-06-18 Thread Stanislav Malyshev
Hi! Maybe TextIterator can be backported from HEAD, because it allows for just that. foreach (new TextIterator($str) as $c) { ... } That'd be a nice addition to intl extension, too - if we implement all functionality. Any volonteers? :) Problem there would be that it would be somewhat

Re: [PHP-DEV] deprecation status of $str{42} versus $str[42]

2008-06-18 Thread Edward Z. Yang
Andrei Zmievski wrote: Maybe TextIterator can be backported from HEAD, because it allows for just that. foreach (new TextIterator($str) as $c) { ... } IIRC, TextIterator is specifically designed for Unicode, letting you iterate over codepoints, combining sequences, characters, words,

Re: [PHP-DEV] deprecation status of $str{42} versus $str[42]

2008-06-18 Thread Andrei Zmievski
Yes, and we can have TextIterator work on binary strings as well (perhaps by adding TextIterator::BYTE constant). -Andrei Edward Z. Yang wrote: Andrei Zmievski wrote: Maybe TextIterator can be backported from HEAD, because it allows for just that. foreach (new TextIterator($str) as $c) {

Re: [PHP-DEV] deprecation status of $str{42} versus $str[42]

2008-06-17 Thread Arvids Godjuks
2008/6/16 Edward Z. Yang [EMAIL PROTECTED]: PHP userland code may not treat strings as first class arrays, but that's certainly how they are represented internally. Anyway, it would be neat if we could get that foreach syntax to work. I get sick of for($i = 0, $c = strlen($str); $i $c;

Re: [PHP-DEV] deprecation status of $str{42} versus $str[42]

2008-06-17 Thread Richard Quadling
2008/6/16 Chris Stockton [EMAIL PROTECTED]: Hello, On Sun, Jun 15, 2008 at 11:20 PM, Arvids Godjuks [EMAIL PROTECTED] wrote: String is an array of chars, always was and is such in any programming language. So I see argument for {} as missing knowledge for some programming basics.

Re: [PHP-DEV] deprecation status of $str{42} versus $str[42]

2008-06-17 Thread Steph Fox
Hi, Seems like you are missing some PHP programming basics. Strings are not an array of chars, please go back to making ping pong in java c# or whatever other little comp sci classes you took. PHP is not any of them. Foreach(foo as $key = $char) {}, after learning, please be quiet and let

Re: [PHP-DEV] deprecation status of $str{42} versus $str[42]

2008-06-17 Thread Stefan Walk
On Tuesday 17 June 2008 08:27:37 Arvids Godjuks wrote: 2008/6/16 Edward Z. Yang [EMAIL PROTECTED]: PHP userland code may not treat strings as first class arrays, but that's certainly how they are represented internally. Anyway, it would be neat if we could get that foreach syntax to work.

Re: [PHP-DEV] deprecation status of $str{42} versus $str[42]

2008-06-17 Thread Edward Z. Yang
Stefan Walk wrote: You're not learning from the mistakes of other languages (ruby in this case, which removed Enumerable from String in 1.9) ... foreach makes no sense for strings, because it's unclear what you want (with unicode terminology here, as this is for php6): for each byte for

Re: [PHP-DEV] deprecation status of $str{42} versus $str[42]

2008-06-17 Thread Chris Stockton
On Tue, Jun 17, 2008 at 2:21 AM, Steph Fox [EMAIL PROTECTED] wrote: Hi, Seems like you are missing some PHP programming basics. Strings are not an array of chars, please go back to making ping pong in java c# or whatever other little comp sci classes you took. PHP is not any of them.

Re: [PHP-DEV] deprecation status of $str{42} versus $str[42]

2008-06-16 Thread Arvids Godjuks
IMHO, remove {} and leave [] for strings. Strings is array of chars, so [] syntax is fully OK

Re: [PHP-DEV] deprecation status of $str{42} versus $str[42]

2008-06-16 Thread Arvids Godjuks
2008/6/14 Chris Stockton [EMAIL PROTECTED]: I personally have always used {} for string offsets because it just felt right. [] seems like it is for arrays, for me, using it on strings makes me feel dirty. Could we maybe visit some of the ideas you have had with {} syntax offering some

Re: [PHP-DEV] deprecation status of $str{42} versus $str[42]

2008-06-16 Thread Robert Cummings
On Mon, 2008-06-16 at 09:20 +0300, Arvids Godjuks wrote: 2008/6/14 Chris Stockton [EMAIL PROTECTED]: I personally have always used {} for string offsets because it just felt right. [] seems like it is for arrays, for me, using it on strings makes me feel dirty. Could we maybe visit

Re: [PHP-DEV] deprecation status of $str{42} versus $str[42]

2008-06-16 Thread Chris Stockton
Hello, On Sun, Jun 15, 2008 at 11:20 PM, Arvids Godjuks [EMAIL PROTECTED] wrote: String is an array of chars, always was and is such in any programming language. So I see argument for {} as missing knowledge for some programming basics. And I don't understand why are you arguing on this.

Re: [PHP-DEV] deprecation status of $str{42} versus $str[42]

2008-06-16 Thread Edward Z. Yang
Chris Stockton wrote: Seems like you are missing some PHP programming basics. Strings are not an array of chars, please go back to making ping pong in java c# or whatever other little comp sci classes you took. PHP is not any of them. Foreach(foo as $key = $char) {}, after learning, please be

Re: [PHP-DEV] deprecation status of $str{42} versus $str[42]

2008-06-14 Thread Lukas Kahwe Smith
On 11.06.2008, at 01:15, Jani Taskinen wrote: Correct me if I'm wrong but wasn't that the last decision we made about it the last time this was brought up? Just undocument it. Totally. It exists, only works with strings (right?! :) and is not recommended. So simply make it disappear from

Re: [PHP-DEV] deprecation status of $str{42} versus $str[42]

2008-06-14 Thread Stefan Walk
On Saturday 14 June 2008 15:26:20 Lukas Kahwe Smith wrote: On 11.06.2008, at 01:15, Jani Taskinen wrote: Correct me if I'm wrong but wasn't that the last decision we made about it the last time this was brought up? Just undocument it. Totally. It exists, only works with strings (right?! :)

Re: [PHP-DEV] deprecation status of $str{42} versus $str[42]

2008-06-14 Thread Chris Stockton
Hello, On Tue, Jun 10, 2008 at 9:11 PM, Andi Gutmans [EMAIL PROTECTED] wrote: Hi, $str{} was considered a best practice for a while so as you can see via Google Code Search it's been used quite a bit. I take the blame for introducing it with the intention to not only create a better

[PHP-DEV] deprecation status of $str{42} versus $str[42]

2008-06-10 Thread Philip Olson
Hello geeks, This email is to confirm that $str{42} is deprecated in favour of $str[42] as of PHP 6. There is some confusion so let's make something official here. A little history: - May, 2001: $str[42]: is documented as deprecated since PHP 4 - Nov, 2005: $str[42]: kept while $str{42}

Re: [PHP-DEV] deprecation status of $str{42} versus $str[42]

2008-06-10 Thread Markus Fischer
Hi, I don't get this deprecation and thus the forced code change at all. Considering the amount of code using this style, see http://www.google.com/codesearch?as_q=\%24[a-z][a-z0-9_]*{[^}]%2B}hl=enas_lang=php and given that no PHP code change has been done I would rather suggest removing the

Re: [PHP-DEV] deprecation status of $str{42} versus $str[42]

2008-06-10 Thread Lars Strojny
Hi Markus, Am Mittwoch, den 11.06.2008, 01:04 +0200 schrieb Markus Fischer: [...] I don't get this deprecation and thus the forced code change at all. Considering the amount of code using this style, see http://www.google.com/codesearch?as_q=\%24[a-z][a-z0-9_]*{[^}]%2B}hl=enas_lang=php and

Re: [PHP-DEV] deprecation status of $str{42} versus $str[42]

2008-06-10 Thread Jani Taskinen
Correct me if I'm wrong but wasn't that the last decision we made about it the last time this was brought up? Just undocument it. Totally. It exists, only works with strings (right?! :) and is not recommended. So simply make it disappear from the docs. See no evil, hear no evil, speak no evil..

Re: [PHP-DEV] deprecation status of $str{42} versus $str[42]

2008-06-10 Thread Paul Reinheimer
So unless this thread changes something, an E_DEPRECATED will be added to HEAD (PHP 6.0.0) for curly brace string access ( $str{42} ) and the documentation will remain as is. I'm well aware that I don't get a vote, so I'll skip the +1. That being said, I'd like to argue in favour of depricating

RE: [PHP-DEV] deprecation status of $str{42} versus $str[42]

2008-06-10 Thread Andi Gutmans
Hi, $str{} was considered a best practice for a while so as you can see via Google Code Search it's been used quite a bit. I take the blame for introducing it with the intention to not only create a better separation between arrays and string offsets but by also then allowing for a cleaner