using strcmp()
| From: | Anthony Ritter | Date: | Sun, 16 Mar 2003 21:39:29 +0000 |
| Subject: | using strcmp() | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-139868@lists.php.net to get a copy of this message | ||
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";
?>