Re: using strcmp()
| From: | Leif K-Brooks | Date: | Sun, 16 Mar 2003 21:46:04 +0000 |
| Subject: | Re: using strcmp() | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-139871@lists.php.net to get a copy of this message | ||
You're missing the ; on this line:
$result=strcmp($firstword, $secondword)
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"; ?>-- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.