Re: using strcmp()

From: Date: Sun, 16 Mar 2003 21:50:56 +0000
Subject: Re: using strcmp()
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-139869@lists.php.net to get a copy of this message
You need a semicolon after the strcmp() function $result=strcmp($firstword, $secondword); LinuxGeek Anthony Ritter wrote:
The following test script for the function strcmp() is from page 114 -115 of PHP (Hungry Minds). I'm getting a parse error on line 6. Using PHP 4.1.1 / MS Win 98 / Apache Server. Many thanks... Tony Ritter .......................................... <? // using strcmp() $firstword="peach"; $secondword="mango"; $result=strcmp($firstword, $secondword) if ($result>=1) { $statement="comes after"; } else if ($result<=-1) { $statement="comes before"; } else { $statement="is the same as"; } echo "The word <b>$firstword</b> $statement"; ?>


« previous php.general (#139869) next »