Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 10-28-2004, 01:10 PM   #1 (permalink)
DavH27
PHP Pilgrim
 
DavH27's Avatar
 
Join Date: Aug 2004
Location: London
Posts: 170
DavH27 is on a distinguished road
Case sensitivity

PHP Code:
<?php

$email 
"DavH";

if (
$email == "davh")
 {
 echo 
"Match";
 }
else
 {
 echo 
"No Match!";
 }

?>
This is a simplified version of what I'm doing. I'm actually comparing an entry in a db with a GET variable but I wanna know why it is returning "No Match"?!!

It matches, surely? How can I compare them regardless of thier case?
__________________
Davy - Programming since 1998 [CV]
Currently working on: n/a
Status: n/a
DavH27 is offline   Reply With Quote
Old 10-28-2004, 01:27 PM   #2 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,487
sde is on a distinguished road
how about:
PHP Code:
if(strtolower($email)==strtolower("daveH"){
  echo 
"match";
}else{
  echo 
"no match";

if you need stronger matching capabilities.. like regular expressions, eregi() will do a case insensitive match.
__________________
Mike
sde is offline   Reply With Quote
Old 10-28-2004, 01:44 PM   #3 (permalink)
DavH27
PHP Pilgrim
 
DavH27's Avatar
 
Join Date: Aug 2004
Location: London
Posts: 170
DavH27 is on a distinguished road
Thanks!
__________________
Davy - Programming since 1998 [CV]
Currently working on: n/a
Status: n/a
DavH27 is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
c simple question problem with switch case if13121 Standard C, C++ 1 10-24-2004 09:43 PM
Help for another program Androto Standard C, C++ 54 10-15-2004 07:21 AM
Upper case string to lower case gamehead200 Standard C, C++ 12 10-15-2004 03:24 AM
My game Dodo Standard C, C++ 2 06-27-2004 10:48 AM
Input from command line Kportertx Java 7 07-15-2003 06:34 AM


All times are GMT -8. The time now is 09:58 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting