August 2003
Intermediate to advanced
1104 pages
19h 27m
English
These functions compare one string to another. They all return integers. A negative integer means the first string comes before the second. Zero means the strings are equal. A positive number means the first string comes after the second. You may consider the hashing functions described later in this function for comparing strings.
The strcasecmp function (Listing 12.17) operates identically to strcmp except that it treats uppercase and lowercase as identical.
<?php
$first = "abc";
$second = "aBc";
if(strcasecmp($first, $second) == 0)
{
print("strings are equal");
}
else
{
print("strings are not equal");
}
?>
|
Read now
Unlock full access