Home  >  Article  >  Backend Development  >  Introduction to PHP strcmp() function_PHP tutorial

Introduction to PHP strcmp() function_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:42:05858browse

The strcmp() function compares two strings.

strcmp syntax:
strcmp(string1,string2)

Parameter Description
string1 Required. Specifies the first string to compare.
string2 Required. Specifies the second string to be compared.

This function returns:
If the two strings are equal<0 - if string1 is less than string2 >0 - if string1 is greater than string2

Example: Use strcmp to determine whether it belongs to a certain One day (based on 00:00)

strcmp(date(Y-m-d,$user->last_time), date("Y-m-d",time())) == 0

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/486075.htmlTechArticlestrcmp() function compares two strings. strcmp syntax: strcmp(string1,string2) Parameter Description string1 Required. Specifies the first string to compare. string2 required. It is stipulated that...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn