Microsoft Word - Core PHP Programming Using PHP to Build Dynamic Web Sites

(singke) #1

string str_repeat(string text, integer count)


The str_repeat function returns a string consisting of the text argument repeated
the number of times specified by the count argument.


<?


print(str_repeat("PHP!
\n", 10));
?>


integer strcasecmp(string first, string second)


The strcasecmp function operates identically to strcmp with the exception that
upper- and lowercase letters are treated as being identical. Check out soundex,
metaphone, and similar_text for alternative ways of comparing strings.


<?


$first = "abc";
$second = "aBc";


if(strcasecmp($first, $second) == 0)
{
print("strings are equal");
}
else
{
print("strings are not equal");
}
?>


strchr


This function is an alias to strstr.


integer strcmp(string first, string second)


The strcmp function compares the first string to the second string. A number less than
zero is returned if the first string is less than the second. Zero is returned if they are equal.
A number greater than zero is returned if the first string is greater than the second string.
Comparisions are made by ASCII values. This function is safe for comparing binary data.

Free download pdf