>
> I'm not sure why it would duplicate the item like that. My interpretation
> of $array[$start:$end] would be "an array containing all those elements of
> $array with a position more than or equal to $start, but less than or equal
> to $end" ($position >= $start && $position <= $end).
>

I agree with this statement now, I was misinterpreting how I thought it
should work, but reading this; I think you're right. Also, your next point
about the unique array indexes covers it anyway, so it doesn't really
matter regardless.

Check my example again. $countdown[0] refers to the element with key 0, so
> is absolutely not a replacement for $countdown[0:0]. This is the whole
> point of my example.


You're correct, this was my mistake.

I'm not sure what you mean by "something that happens nowhere else" PHP has
> syntax for all sorts of things, using all sorts of symbols. Your own
> suggestion uses the : symbol in a place where it currently can't exist.


What I mean by 'symbol' here, is a prefix to tell it what the context of
its use is; in this case, it is the declaration that we are requiring the
index not the key. As far as I'm aware, and can think of at the moment, PHP
has nothing like a hinter symbol.

The only purpose of this symbol is to tell the user that it is indexes not
keys.

Maybe there should be a symbol to declare that, but i'm not sure. Will
appreciate more comments on this.

If we go the direction of using a symbol, what should be the outcome of the
symbol missing? fatal error, or to try to slice based on the keys?

Reply via email to