On May 23, 2011, at 9:28 AM, Alex Nikitin wrote: > There is an interesting note in the comments for strcmp: > "Well, I am using PHP 4.0 and both strcmp and strcasecmp appear to be giving me very arbitrary and incomprehensible results. When I input strings, it appears that "equal" strings return "1", as well as some unequal strings, and that if the first argument is "smaller" then I *tend* to get negative numbers, but sometimes I get 1, and if larger I *tend* to get numbers larger than 1.. " > > > Guessing that earlier versions of php 4 and before would give the results that would have values other then 1, 0, -1, i looked through the change log, but nothing immediately jumped out, there was a lot of mbstring work done, and they did add the nat comparison functions, and play with the pcre engine a bit, which could have caused this as an unintended result for a few versions, i think though it was a bug at some point, so, maybe a php dev would chime in if they remember...? > > > -- Alex -- > -- > The trouble with programmers is that you can never tell what a programmer is doing until it’s too late. ~Seymour Cray All this confusion makes me glad that I'm using === for equality checks instead of strcmp. Regards, -Josh ____________________________________ Joshua Kehn | Josh.kehn@xxxxxxxxx http://joshuakehn.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php