Re: [PHP] A silly question. :P

2002-03-08 Thread Billy S Halsey

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.

Regards,
/bsh/

GENESiS DESiGNS wrote:

Hello everyone,

I would like to know why you put this character (!) in front of this:
?php
$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! 

-GENESiS DESiGNS
-Sean Kennedy
-http://www.gdesigns.vcn.com


-- 


/-=[ 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 (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] A silly question. :P

2002-03-08 Thread Erik Price


On Thursday, March 7, 2002, at 11:50  PM, GENESiS DESiGNS wrote:

 I would like to know why you put this character (!) in front of this:

Nearly unanimously to all programming languages, the bang (!) symbol 
indicates not or negative or inverse or not true.  So you use it 
when you want to indicate that something is not the case or if you are 
performing a test for the lack of a condition rather than the condition 
itself.  Like this:

if ($var) {
   echo Yes, var exists;
} elseif (!$var) {
   echo No, there is no variable called var;
} else {
   echo You cannot reach this part of the if statement.
 Either var exists or it doesn't;
}





(!(Hope that doesn't help)),

Erik






Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] A silly question. :P

2002-03-07 Thread Jason Murray

 I would like to know why you put this character (!) in front of this:

An ! means that the following statement should be false. So:

if (!isset($variable))

means If $variable is not set

Jason

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php