strcasecmp()

From: tony ritter (tony_at_gonefishingguideservice.com)
Date: 08/29/04


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



Relevant Pages

  • Re: Perfmon and batch file
    ... > event viewer and run command file. ... > but no execute the cmd file or execute it but not execute the ... You are probably making some assumptions in your batch file ... @echo off ...
    (microsoft.public.windows.server.general)
  • Re: Batch File Parameters
    ... I am not typing in the file names. ... list, right click, select "SEND TO" and select this batch file from that drop ... It should execute the fatch with all the selected file names as ... >> @echo off ...
    (microsoft.public.windowsxp.general)
  • Re: Assigning the output of a function to a variable
    ... bash-2.03$ echo $a ... doesn't the construct "foo John | read b" work? ... so that the reader and writer can execute concurrently. ... the last command is a shell built-in, and execute this in the shell ...
    (comp.unix.shell)
  • Re: VBScript with Sessionid and RDP
    ... execute the following commands at a Command Prompt in order to examine its ... If you get no output then there you must run this command so that you can ... Remote Desktop Session), only RD Session instance is killed. ... message - how about starting the batch file with "echo on"? ...
    (microsoft.public.scripting.vbscript)
  • Re: Run a PL SQL Package from a shell script
    ... 1)May I know is there any specific reason for "ECHO" should not be ... 2)Moreover I am able to call the package procedure without parameters. ... variance execute multiset the both leading trailing forall ... "execute Package.Procedure" | sqlplus username/password@database ...
    (comp.unix.shell)