Skip to content
Compute difference between two strings
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
.gitignore
LICENSE.md
README.md
composer.json

README.md

PHP str_diff Function

Calculates the difference between two strings.

Usage:

<?php

include 'vendor/autoload.php';

$diff = str_diff(
    'I am inevitable !',
    'I am Iron Man !'
);

echo $diff['common_start']; // "I am"
echo $diff['common_end'];   // " !"
echo $diff['left'];         // "inevitable"
echo $diff['right'];        // "Iron Man"
You can’t perform that action at this time.