PHP Methods for string manipulation

Source: Internet
Author: User
Tags first string php and mysql
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

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.