PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Er. Rochak Chauhan   PHP Compare Strings   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example Script
Class: PHP Compare Strings
Compares strings to determine similarity level
Author: By
Last change:
Date: 13 years ago
Size: 519 bytes
 

Contents

Class file image Download
<?php
//$string1="This is my test string";
//$string2="no match";

//$string1="This is my test string";
//$string2="This is string";

$string1="This is my test string";
$string2="This is my text string";

require(
"phpCompareStrings.inc.php");
$phpCompareStrings=new PhpCompareStrings($string2, $string1);
$percent=$phpCompareStrings->getSimilarityPercentage();
$percent2=$phpCompareStrings->getDifferencePercentage();
echo
'$string1 and $string2 are '.$percent.'% similar and '.$percent2.'% differnt';
?>