Home > Backend Development > PHP Tutorial > strncasecmp() function in PHP

strncasecmp() function in PHP

王林
Release: 2023-09-14 10:06:02
forward
1329 people have browsed it

strncasecmp() function in PHP

strncasecmp() function is used to compare two strings.

Note - This function is not case sensitive.

grammar

strncasecmp(str1,str2,len)
Copy after login

parameter

  • str1 − The first string to be compared

  • str2 − The second string to be compared

  • len − The length of the string used for comparison

return

strcoll() function returns -

  • 0 - If two strings are equal

  • < 0 < 0 - if string1 is less than string2

  • > 0 − If string1 is greater than string2

The Chinese translation of

Example

is:

Example

The following is an example -

Live Demo

<?php
   echo strncasecmp("Demo text!","DEMO word!",4);
?>
Copy after login

Output

0
Copy after login

The above is the detailed content of strncasecmp() function in PHP. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:tutorialspoint.com
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