Search:

Type: Posts; User: campbeld

Search: Search took 0.03 seconds.

  1. For the reason strcmp is the correct way to...

    For the reason strcmp is the correct way to compare strings please re-read the thread. Thanks.
  2. I wondered where that post had gone! Anyway, I...

    I wondered where that post had gone! Anyway, I must get on with things but I have learned so much from both of you.

    Before I posted I had no idea that methods of string comparison in PHP were such...
  3. lexigraphic comparison comes into it's own when...

    lexigraphic comparison comes into it's own when you're sorting..

    So I guess we can say that use "==" just to see if two strings match but only if you can be absolutely certain you are comparing...
  4. yeah in hind site I should have made that more...

    yeah in hind site I should have made that more clear...

    oh your comment on traffic building makes me want to spark another topic because traffic building from forum posts is really really...
  5. strcmp is correct because it ignores programming...

    strcmp is correct because it ignores programming types and does lexigraphic comparison which is more likely what people want
  6. yes when people want to know the correct...

    yes when people want to know the correct comparison operator to use it's usually because they try to compare a number with a string and get unexpected results
  7. No the "===" operator requires both operators to...

    No the "===" operator requires both operators to be the same type for the comparison to be successful.

    For example,

    if you have $stringa = "1" and $b = 1

    and try

    if ($stringa === $b)
    {
  8. No sorry the more I think about it I recommend...

    No sorry the more I think about it I recommend using strcmp and related functions for comparing strings. And to avoid using "==" for string comparisons. Programmers can avoid many accidents that way....
  9. ok can't edit post because it's past the 15...

    ok can't edit post because it's past the 15 minute expiry

    There are the string comparison operators and you can do

    If ($stringa == $stringb)
    {
    // yes, the == operator says they're equal...
  10. Yes there are those functions but they do not...

    Yes there are those functions but they do not produce correct results. I better edit my post. Thanks for that.
  11. Ummm don't use auto_number! Create a separate...

    Ummm don't use auto_number! Create a separate table to store your identifier sequence and manage your own identifiers.

    Use a function "get_next_identifier" to provide the next unreserved...
  12. what is correct string comparison operator php

    Do you want to check and see whether a string is the same as another string?

    Or do you want to check and see whether one string comes alphabetically before another string?

    The good news is PHP...
Results 1 to 12 of 12