Monday, 16 November 2015

4_ Compare 2 String “THE SIMILARITY BETWEEN TWO STRING”

4) Compare 2 String “THE SIMILARITY BETWEEN TWO STRING”


$string1=”HARSHIDA”;
$string2=”HARSHIDA PARMAR”;
similar_text($string1,$string2,$result1);
echo “THE SIMILARITY BETWEEN TWO STRING IS :=>>>” . $result1;


It will compare in the percentage… how much both the string is same…


5) TRIM FUNCTION


$string = “ HARSHIDA D PARMAR “;
$string1 =trim($String);
Echo $string1;
//TRIM THE LEFT SIDE
$string2=ltrim($string);
//TRIM THE RIGHT SIDE
$string3=rtrim($string);


This function used to TRIM the White Space from Left And right side. Means to remove the white space from the both the side. You can see in the $string1



No comments:

Post a Comment