comparing a String ignoring its case

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sfoley77
Forum Newbie
Posts: 15
Joined: Tue Jun 02, 2009 10:13 am

comparing a String ignoring its case

Post by sfoley77 »

I need to write the equilvilant of this statement in php and ignore its case but I cant find a operator in php for it here is the java version:

Code: Select all

customer.getZzaux_contact_by_email().equalsIgnoreCase("Y"))
can anyone show me the way to do this
Thanks
Sean
User avatar
prometheuzz
Forum Regular
Posts: 779
Joined: Fri Apr 04, 2008 5:51 am

Re: comparing a String ignoring its case

Post by prometheuzz »

Try:

Code: Select all

echo strcasecmp("SfolEY77", "sfoley77");
BornForCode
Forum Contributor
Posts: 147
Joined: Mon Feb 11, 2008 1:56 am

Re: comparing a String ignoring its case

Post by BornForCode »

prometheuzz means:

Code: Select all

 
if(!strcasecmp('nici','Nici')) {
    echo 'jackpot are equals';
}
else
{
    echo 'Bleah';
}
 
Last edited by Benjamin on Tue Jun 30, 2009 10:33 am, edited 1 time in total.
Reason: Changed code type from text to php.
Post Reply