Need some help with case sensitive characters

Discussion in 'PHP' started by byteventures, Mar 7, 2007.

  1. #1
    In my current script, I would like to have certain text be recognized as case sensitive. For example, if the value is "OMM" the code below will accept "omm" and "OmM" and any form of the text.

    "$replace_strings = array_values($mapping);"

    Is there any way to make this value case sensitive? Thanks in advance for your reply.
     
    byteventures, Mar 7, 2007 IP
  2. frankcow

    frankcow Well-Known Member

    Messages:
    4,859
    Likes Received:
    265
    Best Answers:
    0
    Trophy Points:
    180
    #2
    Do you mean case-insensitive? If you want it to match any casing, then convert all values to lower case with str_to_lower()
     
    frankcow, Mar 7, 2007 IP
  3. byteventures

    byteventures Guest

    Messages:
    200
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    It already matches any casing. I need the characters to match the exact casing, which would be only upper case characters.
     
    byteventures, Mar 7, 2007 IP
  4. byteventures

    byteventures Guest

    Messages:
    200
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    For example, I only want to have "PHP" recognized and the value should ignore Php, php or PHp. I hope this is being explained clearly.

    Thanks.
     
    byteventures, Mar 7, 2007 IP
  5. TwistMyArm

    TwistMyArm Peon

    Messages:
    931
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    0
    #5
    The function strcmp will do case-sensitive string comparisons...

    However: having another look at the snippet of code you've provided, I can't see how that is case-insensitive (there's no string comparisons at all). I'm guessing that where you use $replace_strings is where you will need to do the case-sensitive work, but we would need to see where you use it to actually help.
     
    TwistMyArm, Mar 7, 2007 IP
  6. frankcow

    frankcow Well-Known Member

    Messages:
    4,859
    Likes Received:
    265
    Best Answers:
    0
    Trophy Points:
    180
    #6
    You may have to use regular expression searching then
     
    frankcow, Mar 7, 2007 IP
  7. giraph

    giraph Guest

    Messages:
    484
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    0
    #7
    giraph, Mar 7, 2007 IP
  8. jcyber

    jcyber Active Member

    Messages:
    892
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    80
    #8
    i agree please use lower case for this.....it's an simple request to author....:)
     
    jcyber, Jun 30, 2011 IP