Re: [Zend Engine 2] substr changes

From: Date: Fri, 29 Jun 2001 12:11:44 +0000
Subject: Re: [Zend Engine 2] substr changes
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-58420@lists.php.net to get a copy of this message
On Fri, 29 Jun 2001, Jeroen van Wolffelaar wrote: > > 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--) > substr('abcdef',0,$i); > > wich your proposed change, you get: > (i=5) abcde > 4 abcd > 3 abc > 2 ab > 1 a > 0 abcdef ! Indeed, I read it wrong, but anyway, the current implementation returns an empty string (''), so I really don't see what the problems with substr are. Derick

« previous php.dev (#58420) next »