Re: [PHP-DEV] Re: Str enhancement, final run From: André Langhorst (andre <email protected>)
Date: 07/15/01

> 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é

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>