PHP strchr() Function


The strcmp() function is used to compare two strings is binary safe and case-sensitive.

Syntax
strchr(string,search,before_search)
Parameters
  • String 1 - (Required) Specify the first string to compare.
  • String 2 - (Required) Specify the second string to compare.
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