This article mainly introduces the method of PHP for string manipulation, the interested friend's reference, I hope to help you.
In this paper, we describe a simple method for PHP to determine whether two strings are equal, and how to do this:
Definition and usage
The strcasecmp () function compares two strings.
Tip: the strcasecmp () function is binary safe and is case-insensitive.
Tip: This function is similar to the strncasecmp () function, but by strncasecmp () you can specify the number of characters each string is used to compare.
Examples are as follows:
<?php function StrComp ($str 1, $str 2) { if ($str 1 = = $str 2) { return TRUE; } else{ return false; }} Echo StrComp ("First string", "Second string")//returns FALSE Echo StrComp ("A string", "a s Tring ");//returns TRUE?>
Summary: the above is the entire content of this article, I hope to be able to help you learn.
Related recommendations:
PHP implements the conversion of images to ASCII code
Use of the switch statement in PHP
How to count the number of people online through PHP
Based on jquery, PHP and MySQL achieve a rating function
How to get the first letter of Chinese pinyin in PHP program