> > Yes,  of course. But in a loop when you use for ($i=-3; $i<=0; $i--)...
> > had this twice, I needed to make special case for the last possibility.
> This works fine: $i will contain, -3, -2, -1 and 0 (and not -0), but
> indeed I agree that substr ('str', 0, 0) should return this: 'str'. This
> change can be easily made in the current sources. If nobody objects, I'll
> change it.

This is IMO 'van de regen in de drup', i.e. making it worse... The kind of
loop I mentioned isn't as current as a loop like this:

for ($i=5;$i>=0;$i--)

wich your proposed change, you get:
(i=5) abcde
4 abcd
3 abc
2 ab
1 a
0 abcdef !

This has to do with the fact that 0 ==== -0 (4 ='s, it's really identical),
and that you can loop to 0 in two ways, which have completely, incompatible

I think that if it is changed, you'll break quite some scripts... the
problem isn't in the current implementation, it's in the idea behind letting
negative values have a special meaning.

By the way, IMO the negative values with substr rate higher on WTF than
{left,length[,right]}, though it may seem different because you're used to

> regards,
> Derick


PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to