how to search for uppercase and lowercase variables?

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
deras
Forum Newbie
Posts: 24
Joined: Sun Nov 02, 2003 10:26 am

how to search for uppercase and lowercase variables?

Post by deras »

i have a search script which eliminates the search word from the search results.

foreach ($arrinterests as $interest) {
$interest = trim($interest);

however if the case is different, it does not work. so if i search for 'sports', 'sports' does not get returned, but if i search for 'Sports', 'sports' does get returned.

how do i make it so 'sports' does not get returned when someone searches for 'Sports' how do i trip and case version of the word sports, i.e. SPORTS, Sports, SpOrTs, etc?
User avatar
protokol
Forum Contributor
Posts: 353
Joined: Fri Jun 21, 2002 7:00 pm
Location: Cleveland, OH
Contact:

Post by protokol »

I'm not sure I completely understand what you're asking, but these functions might be useful:

strcasecmp()
strtolower()
strtoupper()
Post Reply