Login   Register  
PHP Classes
elePHPant
Icontem

File: synchanalysis.example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Vladimir S. Bredihin  >  Synchronization Analysis  >  synchanalysis.example.php  >  Download  
File: synchanalysis.example.php
Role: Example script
Content type: text/plain
Description: Example used SynchAnalysis.class.php
Class: Synchronization Analysis
Compare and extract differences between texts
Author: By
Last change:
Date: 8 years ago
Size: 502 bytes
 

Contents

Class file image Download
<?php
require_once ('synchanalysis.class.php');

$text1 
"Line0

Line1
Line2
Line3
Line4"
;
$text2 
"Line0
Line1
Line3

Line2"
;
$source = array ('text1'=>$text1'text2'=>$text2);

    
$SC = new SynchAnalysis ();
    
xmp ($source'Source');
    
$diff $SC->synch ($source);
    
xmp ($diff'Result');
function 
xmp (&$a$label null)
{
    
$nl "\r\n";
    if (
$label) print "{$nl}<hr /><b>{$label}:</b>{$nl}";
    print 
"{$nl}<xmp>{$nl}";
    
print_r ($a);
    print 
"{$nl}</xmp>{$nl}";
}
?>