Your Open Source

 
Related Links

PHP

String Comparison In PHP

String Comparison in php
strcmp() is used to compare the given strings
Syntax:

 strcmp(string1,string2); 

and it Returns < 0 if string1is less than string2; > 0 if string1 is greater than string2, and 0 if they are equal.
Note : strcmp comparison is case sensitive

//String Comparison

$string1="This is an Example ";
$string2="This is";
$string3="This is";

$compare = strcmp($string1,$string2);
//is not equal and return false;

$cmp = strcmp($string3,$string2);
// return true;

  • hits 172
  • datetime Jul 29 08 06:52:11
  • author Psbharathy
  • rating

Rating : 12345

Comments

No Reply..

Quick Reply or Comments

Preview
Your Name:
Your Reply :
<> is a code tag
Enter the verification code: