wdalmut / diff
LSM - Longest Common Subsequence
1.0.0
2012-09-04 00:00 UTC
Requires
- php: >=5.3.3
This package is not auto-updated.
Last update: 2024-12-16 12:01:55 UTC
README
<?php require_once __DIR__ .'/../src/Wally/Diff.php'; use Wally\Diff; $m = new Diff(); echo $m->getDiff('Hi, my name is Walter','Hi, my name is Laura');
The output is:
- Hi, my name is Walter
+ Hi, my name is Laura
Complex input
See a more complex example:
<?php echo $m->getDiff(<<<EOF Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris ullamcorper nisi at enim adipiscing vehicula. Pellentesque accumsan rutrum porta. Sed interdum tortor urna, et condimentum orci. Vivamus condimentum ultricies justo vitae lobortis. Suspendisse blandit consectetur pulvinar. Ut vitae mauris quis enim convallis elementum. Vestibulum id dictum nisl. EOF ,<<<EOF Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris ullamcorper nisi at enim adipiscing vehicula. Pellentesque accumsan rutrum porta. Sed interdum cake urna, et condimentum orci. Vivamus condimentum ultricies justo vitae lobortis. Suspendisse blandit consectetur plumbe. Ut vitae mauris quis enim convallis elementum. Vestibulum id dictatum nisl. EOF );
The output is:
Lorem ipsum dolor sit amet,
consectetur adipiscing elit.
Mauris ullamcorper nisi at enim adipiscing vehicula.
Pellentesque accumsan rutrum porta.
- Sed interdum tortor urna, et condimentum orci.
+ Sed interdum cake urna, et condimentum orci.
Vivamus condimentum ultricies justo vitae lobortis.
- Suspendisse blandit consectetur pulvinar.
+ Suspendisse blandit consectetur plumbe.
Ut vitae mauris quis enim convallis elementum.
- Vestibulum id dictum nisl.
+ Vestibulum id dictatum nisl.