Laruence wrote:
yes, substr_compare can do it, and it also supports negative
length argument too.
I am with Rasmus ... while the BC problem he is pointing out is probably very
rare, those are the worse ones to fix when they pop up intermittently, and
usually when 10 year old code has been working fine and suddenly starts doing it?
All of the original base str... functions currently follow the libc manual ( I
think ) and that is how they work. My first thought when the thread started was
that this needed a different name - which is exactly why substr_compare exists?
Although nothing is appearing in my archive, I'm sure that this discussion has
already happened long ago when this was added to PHP5? Perhaps it should be
linked in the SeeAlso from strncmp and the rest?
> but I am proposal to improve strn(case)cmp, so they are not conflict .:)
One persons improvement can become someone elses BC nightmare?
I seem to recall a discussion about tidying up many of the string functions,
probably part of unicode compatibility, and in that vane, would it be possible
to create a 'namespace' version of string functions which could be a little more
consistent, and also offer the chance to switch to full unicode comparison if
required? sb:: -> mb:: transparently working the same way? needle and haystack
order comes to mind as well?
Is there any reason there is not an mb_substr_compare ?
Yes character based rather than byte. Seems to me that this is the way to go
rather than changing the other functions? Actually substr_compare will tidy up a
bit of a mess in my own code where I need to switch case on and off I'd just not
remembered it existed ....
--
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php