PhP character comparison problem...

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mandragon03@gmail.com

    PhP character comparison problem...

    I am trying to strip the ¿ and ¡ from some Spanish phrases in my
    database. I pull the query data from the MySql database (using PhP)
    and I know it is returning the correct rows because I have verified
    it by printing it out in Firefox.

    When I try this:

    if( substr($Phrases Row[0], 0, 1) == "¿" || substr($Phrases Row[0], 0,
    1) == "¡" )

    or

    if( mb_substr($Phra sesString[0], 0, 1) == "¿" || mb_
    substr($Phrases String[0], 0, 1) == "¡" )

    it never makes it into the 'if' block even though I have verified
    there are phrases that meet this criteria.

    Does anyone have a suggestion on how to get it to recognize that these
    phrases start with '¿' or '¡' ?

    Thanks for your ideas,

    Mandragon
  • NC

    #2
    Re: PhP character comparison problem...

    On Jul 10, 3:23 pm, Mandrago...@gma il.com wrote:
    >
    I am trying to strip the ¿ and ¡ from some Spanish phrases
    in my database.
    And in what encoding is the Spanish text stored in the database?
    Additionally, are you sure that "¿" and "¡" are stored as such, rather
    than, say, "¿" and "¡"?

    Cheers,
    NC

    Comment

    • macca

      #3
      Re: PhP character comparison problem...

      On Jul 10, 11:23 pm, Mandrago...@gma il.com wrote:
      I am trying to strip the ¿ and ¡ from some Spanish phrases in my
      database.

      $find = array('¿','¡',' ¿',;¡ ');

      $PhrasesString = str_replace($fi nd,'',$PhrasesS tring);

      Comment

      Working...