1. Go to this page and download the library: Download nochso/diff library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
nochso / diff example snippets
$diff = \nochso\Diff\Diff::create('foo', 'bar');
foreach ($diff->getDiffLines() as $line) {
if ($line->isRemoval()) {
echo 'Line ' . $line->getLineNumberFrom() . " was removed:\n";
echo $line->getText() . "\n";
}
}
$formatter = new \nochso\Diff\Format\Template\Text();
echo $formatter->format($diff);
$context = new ContextDiff();
$context->setMaxContext(2);
$diff = Diff::create($from, $to, $context);
$gfm = new \nochso\Diff\Format\Template\GithubMarkdown();
echo $gfm->format($diff);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.