Strpos is used to find one or more strings in one string code: $ str1 & amp; #39; ext-gen1226 & amp; #39 ;$ str2 & amp; #39; ext & amp; #39; // echostrpos ($ str1, str2, 0); if (strpos ($ str1, str2, 0) false) {echo & amp strpos is used to find one or more strings in one string.
Code:
$ Str1 = 'ext-gen1226 ';
$ Str2 = 'ext ';
// Echo strpos ($ str1, str2, 0 );
If (strpos ($ str1, str2, 0) = false ){
Echo 'AAA ';
} Else {
Echo 'BBB ';
}
Result: AAA
Normally, the output is BBB. this is because str2 is at the first position of str1. The result is that strpos returns 0. the default value is false. We use the double equal sign to judge, therefore, AAA is returned;
$ A = $ B is equal to TRUE if $ a is equal to $ B.
$ A ===$ B all equal to TRUE, if $ a is equal to $ B, and their types are the same. (PHP 4 is introduced, so it can be determined by changing it to three equal signs.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service