PHP Programing language

strcmp() Functions in PHP
Previous Home Next
adplus-dvertising

strcmp()

The strcmp() function compares two strings. This function returns:

  1. 0 – if the two strings are equal
  2. <0 – if string1 is less than string2
  3. >0 – if string1 is greater than string2
Syntax :
strcmp("string1","string2");

Example:

<?php 
echo strcmp("Gud Morning!","Gud Morning!!!"); 
?>

Output:

-2

Previous Home Next