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

Introduction to PHP strcmp() function_PHP tutorial

WBOY
Release: 2016-07-13 17:42:05
Original
899 people have browsed it

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...
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template