strcasecmp()
From: tony ritter (tony_at_gonefishingguideservice.com)
Date: 08/29/04
- Next message: Andy Hassall: "Re: strcasecmp()"
- Previous message: j0sh: "mime email"
- Next in thread: Andy Hassall: "Re: strcasecmp()"
- Reply: Andy Hassall: "Re: strcasecmp()"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 29 Aug 2004 10:58:47 -0400
<?
$first_name = "Hello";
$second_name = "Hello";
if(strcasecmp($first_name,$second_name)) {
echo "words are equal";
}
else
{
echo "words are not equal.";
}
?>
..............
In strcasecmp() - this comparison will return 0 - interpreted by PHP as
FALSE - eventhough words are _equal_ so what will execute is "words are not
equal".
whereas if the negation symbol of ! is inserted as in:
.......
<?
$first_name = "Hello";
$second_name = "Hello";
if(!strcasecmp($first_name,$second_name)) {
echo "words are equal";
}
else
{
echo "words are not equal.";
}
?>
...........
to read if the comparsion which is returned is not _FALSE_ excecute:
"words are equal."
.............
Am I on the right track with this logic?
Thank you.
TR
- Next message: Andy Hassall: "Re: strcasecmp()"
- Previous message: j0sh: "mime email"
- Next in thread: Andy Hassall: "Re: strcasecmp()"
- Reply: Andy Hassall: "Re: strcasecmp()"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|