PHP strcasecmp() Function


The strcasecmp() function is used to compare two given string. It is binary safe and case-insensitive.This is similar to the strcasecmp() function.

Syntax
strcasecmp(string1,string2)
Parameters
  • String 1 - (Required) Specify the First string to compared.
  • String 2 - (Required) Specify the second string to compared.
Example
<?php
    echo strcasecmp("Hii Hello!","HII HELLO!");
?>

Output

0
This Function returns 0 ,the two strings are equal.
Example
<?php
    echo strcasecmp("Hii Hello!","HI")."<br>"; 
    echo strcasecmp("Hii Hello!","HII HELLO! HOW ARE YOU ?"); 
?>

Output

8
-14

Prev Next