
- PHP Tutorial
- PHP - Home
- PHP - Introduction
- PHP - Environment Setup
- PHP - Syntax Overview
- PHP - Variable Types
- PHP - Constants
- PHP - Operator Types
- PHP - Decision Making
- PHP - Loop Types
- PHP - Arrays
- PHP - Strings
- PHP - Web Concepts
- PHP - GET & POST
- PHP - File Inclusion
- PHP - Files & I/O
- PHP - Functions
- PHP - Cookies
- PHP - Sessions
- PHP - Sending Emails
- PHP - File Uploading
- PHP - Coding Standard
- Advanced PHP
- PHP - Predefined Variables
- PHP - Regular Expression
- PHP - Error Handling
- PHP - Bugs Debugging
- PHP - Date & Time
- PHP & MySQL
- PHP & AJAX
- PHP & XML
- PHP - Object Oriented
- PHP - For C Developers
- PHP - For PERL Developers
- PHP Form Examples
- PHP - Form Introduction
- PHP - Validation Example
- PHP - Complete Form
- PHP login Examples
- PHP - Login Example
- PHP - Facebook Login
- PHP - Paypal Integration
- PHP - MySQL Login
- PHP AJAX Examples
- PHP - AJAX Search
- PHP - AJAX XML Parser
- PHP - AJAX Auto Complete Search
- PHP - AJAX RSS Feed Example
- PHP XML Example
- PHP - XML Introduction
- PHP - Simple XML
- PHP - Simple XML GET
- PHP - SAX Parser Example
- PHP - DOM Parser Example
- PHP Frame Works
- PHP - Frame Works
- PHP - Core PHP vs Frame Works
- PHP Design Patterns
- PHP - Design Patterns
- PHP Function Reference
- PHP - Built-In Functions
- PHP Useful Resources
- PHP - Questions & Answers
- PHP - Useful Resources
- PHP - Discussion
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
PHP - xdiff Functions
xdiff extension can enable us to create and apply patch files containing differences between different revisions of files.
This extension can support two modes of operation: on strings and on files, as well as two different patch formats: unified and binary. The unified patches are excellent for text files as they are human-readable and easy to review. For binary files: archives or images, the binary patches can be an adequate choice as they are binary safe and handle non-printable characters.
Starting from version 1.5.0, there are two different sets of functions to generate binary patches. The new functions: xdiff_string_rabdiff() and xdiff_file_rabdiff() can generate output compatible with older functions but are typically faster and generate smaller results.
This extension can use libxdiff to implement these functions.
Predefined Constants
The constants are defined below by this extension and can be available only when an extension has either compiled into PHP or dynamically loaded at runtime.
- XDIFF_PATCH_NORMAL (integer) − This flag indicates that xdiff_string_patch() and xdiff_file_patch() functions should create result by applying patch to original content thus creating newer version of file. This is the default mode of operation.
- XDIFF_PATCH_REVERSE (integer) − This flag indicated that xdiff_string_patch() and xdiff_file_patch() functions should create result by reversing patch changed from newer content thus creating original version.
Sr.No | Function & Description |
---|---|
1 | xdiff_file_bdiff()
Function can make a binary diff of two files. |
2 | xdiff_file_bdiff_size()
Function can read the size of a file created by applying a binary diff. |
3 | xdiff_file_bpatch()
Function can patch a file with a binary diff. |
4 | xdiff_file_diff()
Function can make a unified diff of two files. |
5 | xdiff_file_diff_binary()
Function can make a binary diff of two files. |
6 | xdiff_file_merge3()
Function can merge three files into one.. |
7 | xdiff_file_patch()
Function can patch a file with an unified diff. |
8 | xdiff_file_patch_binary()
Function is an alias of xdiff_file_bpatch(). |
9 | xdiff_file_rabdiff()
Function can make a binary diff of two files by using Rabin's polynomial fingerprinting algorithm. |
10 | xdiff_string_bdiff()
Function can make a binary diff of two strings. |
11 | xdiff_string_bdiff_size()
Function can read the size of a file created by applying a binary diff. |
12 | xdiff_string_bpatch()
Function can patch a string with binary diff. |
13 | xdiff_string_diff()
Function can make a unified diff of two strings. |
14 | xdiff_string_diff_binary()
Function is an alias of xdiff_string_bdiff(). |
15 | xdiff_string_merge3()
Function can merge three strings into one. |
16 | xdiff_string_patch()
Function can patches a string with an unified diff. |
17 | xdiff_string_patch_binary()
Function is an alias of xdiff_string_bpatch(). |
18 | xdiff_string_rabdiff()
Function can make a binary diff of two strings by using Rabin's polynomial fingerprinting algorithm. |