xdiff_string_diff

(PECL xdiff >= 0.2.0)

xdiff_string_diffMake unified diff of two strings

Beschreibung

xdiff_string_diff(
    string $old_data,
    string $new_data,
    int $context = 3,
    bool $minimal = false
): string

Makes an unified diff containing differences between old_data string and new_data string and returns it. The resulting diff is human-readable. An optional context parameter specifies how many lines of context should be added around each change. Setting minimal parameter to true will result in outputting the shortest patch file possible (can take a long time).

Parameter-Liste

old_data

First string with data. It acts as "old" data.

new_data

Second string with data. It acts as "new" data.

context

Indicates how many lines of context you want to include in the diff result.

minimal

Set this parameter to true if you want to minimalize the size of the result (can take a long time).

Rückgabewerte

Returns string with resulting diff or false if an internal error happened.

Beispiele

Beispiel #1 xdiff_string_diff() example

The following code makes unified diff of two articles.

<?php
$old_article 
file_get_contents('./old_article.txt');
$new_article $_REQUEST['article']; /* Let's say that someone pasted a new article to html form */

$diff xdiff_string_diff($old_article$new_article1);
if (
is_string($diff)) {
    echo 
"Differences between two articles:\n";
    echo 
$diff;
}

?>

Anmerkungen

Hinweis:

This function doesn't work well with binary strings. To make diff of binary strings use xdiff_string_bdiff()/xdiff_string_rabdiff().

Siehe auch

Hier Kannst Du einen Kommentar verfassen


Bitte gib mindestens 10 Zeichen ein.
Wird geladen... Bitte warte.
* Pflichtangabe
Es sind noch keine Kommentare vorhanden.

Was genau bedeutet "Vibe Coding"? Ein tiefgehender Blick für Entwickler

In der Welt der Softwareentwicklung gibt es unzählige Wege, wie man an ein Projekt herangeht. Manche schwören auf strikte Planung, andere auf bewährte Algorithmen und wieder andere lassen sich von etwas ganz anderem leiten: ihrem Gefühl. ...

admin

Autor : admin
Kategorie: Software & Web-Development

PHP cURL-Tutorial: Verwendung von cURL zum Durchführen von HTTP-Anfragen

cURL ist eine leistungsstarke PHP-Erweiterung, die es Ihnen ermöglicht, mit verschiedenen Servern über verschiedene Protokolle wie HTTP, HTTPS, FTP und mehr zu kommunizieren. ...

TheMax

Autor : TheMax
Kategorie: PHP-Tutorials

Midjourney Tutorial - Anleitung für Anfänger

Über Midjourney, dem Tool zur Erstellung digitaler Bilder mithilfe von künstlicher Intelligenz, gibt es ein informatives Video mit dem Titel "Midjourney Tutorial auf Deutsch - Anleitung für Anfänger" ...

Mike94

Autor : Mike94
Kategorie: KI Tutorials

Tutorial veröffentlichen

Tutorial veröffentlichen

Teile Dein Wissen mit anderen Entwicklern weltweit

Du bist Profi in deinem Bereich und möchtest dein Wissen teilen, dann melde dich jetzt an und teile es mit unserer PHP-Community

mehr erfahren

Tutorial veröffentlichen

SELL FULLSsn Dob DL CS CC CVV US UK AUS CA EU ASIA INTER,PASS VBV/BIN/DOB1

VERIFIED CARDER SELLING WU,BANK,PAYPAL,CASHAPP,SKRILL TRANSFER BANK LOGS,DUMPS+PIN,CLONED CARDS​ SELL CCV CANADA FULLZ FRESH SSN DOB WITH DL LI ...

Geschrieben von sellergood11 am 19.05.2026 13:55:53
Forum: Netzwerk &amp; Internet
@king_dumps12 Sell Valid CVV Dumps With Pin, Buy Dumps CVV Online, Legit CVV Shop

*************************** I'm good hacker and verified seller Having experience in information technology in 9 years I need best buyer and long ...

Geschrieben von sellergood11 am 19.05.2026 13:53:07
Forum: Windows (Client/Server)
telegram:@king_dumps12 SELL CC CVV CVV2 DUMPS12 WITH PIN FULL 2026 ALL COUNTRY

HOT Seller CVV Good 2026 - NON VBV Credit Card/Debit Card U.P.D.A.T.E CVV 2026 Sell CVV Good info And High Balance (Cvv CC Fullz Credit Cards D ...

Geschrieben von sellergood11 am 19.05.2026 13:51:33
Forum: Grafik / Design / Flash ...
@king_dumps12 Sell cvv US-UK-AUS-CA-EU-ASIA-dump12 2026 FULL Ssn CS Dob DL fresh

HOT Seller CVV Good 2026 - NON VBV Credit Card/Debit Card U.P.D.A.T.E CVV 2026 Sell CVV Good info And High Balance (Cvv CC Fullz Credit Cards Du ...

Geschrieben von sellergood11 am 19.05.2026 13:50:17
Forum: SEO - Suchmaschinen Tricks und Tipps