Re: substr/array_slice in []

From: Date: Tue, 09 Oct 2007 16:42:51 +0000
Subject: Re: substr/array_slice in []
References: 1 2 3 4 5 6 7 8  Groups: php.internals 
Request: Send a blank email to internals+get-32716@lists.php.net to get a copy of this message
operator is definitely easier because it lets us reuse the same syntax for strings and arrays (and people would need to learn one operator
Having same syntax mean two different things (string access / array access) doesn't qualify as "easy" in my book anyway. I know there's a language which uses only 8 characters for everything (since this is a family-oriented mailing list, I'm not going to mention it by name ;) - but it is hardly easy. I would be kind of OK if we made substring operator be {X:Y}, but for array operator I don't really see how it's substantially better than calling array_splice. It has a bit less characters to type, but less typing is not always better. It also doesn't make sense in a lot of array contexts (what is $a["apples":"oranges"]?) so it doesn't extend old [] syntax naturally. -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com

« previous php.internals (#32716) next »