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

strncasecmp() function in PHP

王林
王林forward
2023-09-14 10:05:021292browse

strncasecmp() function in PHP

strncasecmp() function is used to compare two strings.

Note - This function is not case sensitive.

grammar

strncasecmp(str1,str2,len)

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

  • - 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);
?>

Output

0

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

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete