browse: forums | FAQ
Connecting Tech Pros Worldwide

Hey there! Do you need PHP help?

Get answers from our community of PHP experts on BYTES! It's free.

PhP character comparison problem...

Mandragon03@gmail.com
Guest
 
Posts: n/a
#1: Jul 10 '08
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($PhrasesRow[0], 0, 1) == "¿" || substr($PhrasesRow[0], 0,
1) == "¡" )

or

if( mb_substr($PhrasesString[0], 0, 1) == "¿" || mb_
substr($PhrasesString[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
Guest
 
Posts: n/a
#2: Jul 11 '08

re: PhP character comparison problem...


On Jul 10, 3:23 pm, Mandrago...@gmail.com wrote:
Quote:
>
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
macca
Guest
 
Posts: n/a
#3: Jul 13 '08

re: PhP character comparison problem...


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

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

$PhrasesString = str_replace($find,'',$PhrasesString);
Closed Thread