Diff wrapper.
A simple wrapper of Linux diff utility to compare text data line by line.
This class just use Linux diff
command.
- Version
- 1.0
- Author
- Digger mrdig.nosp@m.ger@.nosp@m.sad-s.nosp@m.yste.nosp@m.ms.ru
- Copyright
- (c) 2016, SAD-Systems
Example of usage:
<?php
print_r(
Diff::diff(
'some text1',
'some text2') );
list($data1, $data2) =
Diff::compare(
'some text1',
'some text2');
function map($data) {
return array_map(function($value){
list($state, $string) = $value;
return ($state ? $state : ' ') . ": " . $string;
}, $data);
}
echo "The first text data: " . print_r( map($data1), true ) . "\n";
echo "The second text data: " . print_r( map($data2), true ) . "\n";