library php-diff
LSM - Longest Common Subsequence
ohmybrew/php-diff
LSM - Longest Common Subsequence
- Thursday, July 6, 2017
- by ohmybrew
- Repository
- 0 Watchers
- 1 Stars
- 3 Installations
- PHP
- 0 Dependents
- 0 Suggesters
- 1 Forks
- 0 Open issues
- 2 Versions
- 0 % Grown
PHP Diff
This library simply gets the differences between strings with a few options to output the changes into raw array, xml or text formats., (*1)
, (*2)
Installation
The recommended way to install is through composer., (*3)
composer require osiset/php-diff
Usage
setStringOne(
setStringTwo(
execute();
$result = $diff->getResult(); // This outputs a raw array of line, delete and insert operations.
$format = new Text($result);
$format->execute();
header('Content-Type: '.$format->getFormatMime());
print $format->getResult();
```
The output is:
```
one
two
- three
+ threes
+ six
```
Above was the use of the `text` output. You may also output the raw `array` via `$diff->getResult()` or you can ouput in XML format like below:
```php
use Wally\PHPDiff\Format\XML;
...
$result = $diff->getResult();
$format = new XML($result);
$format->execute();
header('Content-Type: '.$format->getFormatMime());
print $format->getResult();
```
The output is:
```xml
<data>
<line>one</line>
<line>two</line>
<delete>three</delete>
<insert>threes</insert>
<insert>six</insert>
</data>
dev-master
9999999-dev
LSM - Longest Common Subsequence
Sources
Download
MIT
The Requires
The Development Requires
by
Tyler King
common
longest
subsequence
lsm
1.0.0
1.0.0.0
LSM - Longest Common Subsequence
Sources
Download
MIT
The Requires
common
longest
subsequence
lsm