On Wed, 2003-11-19 at 19:30, Andi Gutmans wrote: > Isn't it a mistake to give a start position at the end or beyond the > string?
You could easily argue, that beyond the end is an error, but I agree with the way Perl allows the start to be at the end. I think of it as with (pseudo-) C: char str[] = { 'A', 'B', '\0' }; substr(str, 0) == "AB" substr(str, 2) == "" substr(str, 3) ERROR > In this case, doesn't it make sense to return false? If things doesn't make sense, I think there should be some kind of warning too (like with array to string cast). On Wed, 2003-11-19 at 22:30, Jani Taskinen wrote: > IF you change it, it'll break BC.. :) True, but if you do it like Perl, it will only break BC for the case where start is at the end of string, which is an error now. > IMO, it should just give an error in such case, and return FALSE too. Yes, with the case where start is beyond the end (which is an error), there should be a warning or an error. Morten -- Morten Poulsen <[EMAIL PROTECTED]> http://www.afdelingp.dk/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php