Greetings Sean,

The ! in front of strcasecmp means, "if strcasecmp returns zero." If you 
look at the reference manual for strcasecmp and strcmp, you'll see that 
it returns zero if the two strings are equivalent -- somewhat of a 
strange return value, but (1) that's how C/C++ do it; and (2) it has 
value in that a positive or negative return value tells you which string 
comes first, so a zero means they are equivalent.



>Hello everyone,
>I would like to know why you put this character (!) in front of this:
>$var1 = "Hello";
>$var2 = "hello";
>if (!strcasecmp($var1, $var2)) {
>    echo '$var1 is equal to $var2 in a case-insensitive string comparison';
>Do you see the (!) in front of the strcasecmp() function? That! Why do you put 
>that there? 
>I'm trying to learn PHP, but it's been kinda hard. THANKS A LOT GUYS! 
>-Sean Kennedy

/---------------------------------------------=[ BILLY S HALSEY ]=--\
| Member of Technical Staff, Sun Microsystems, Inc. ESP Solaris SW  |
| "All opinions and technical advice offered in this message are my |
| own and not necessarily endorsed by my employer."                 |
\--=[ [EMAIL PROTECTED] ]=--------------------------------------------/

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to