Re: Re: Str enhancement, final run

From: Date: Sun, 15 Jul 2001 14:59:55 +0000
Subject: Re: Re: Str enhancement, final run
References: 1 2  Groups: php.dev 
Request: Send a blank email to php-dev+get-60056@lists.php.net to get a copy of this message
Yes, I think that for strings we should limit it to ranges like $foo{4..6}, and it would be neat if we for arrays could do $foo[4..6]. ":" might be just as well as "..". It is more intuitive with ".." I think, but I also kind of like having a single character.
4:6 is more of a soccer result than intuitive ;) $foo[$a] should return array(item) $foo[$a..$n] returns array of items $a to $n it seems obvious to implement this for arrays, array_slice() and substr() both have identical syntax. you could easily cut bigger arrays into smaller ones then, without hazzle. any opinions about array slicing in the language itself? IMO all points discussed for string slicing also apply to array slicing andré

« previous php.dev (#60056) next »