Htaccess    html   Php    javascript   Asp   css    maths  Past Questions  Practice Tests Online

xdiff string patch function syntax tag tutorial 2013 Donate at flattr Flattr this





Alert! Connect with 10,000 Chating Online. Join Now

Php xdiff string patch () function

Write your php code

 
<?php ?>

Php Result


Your code below



(no version information, might be only in CVS)

xdiff_string_patch --  Patch a string with an unified diff

Syntax

string xdiff_string_patch ( string str, string patch [, int flags [, string &error]] )

xdiff_string_patch() patches string str with unified patch in string patch.

flags can be either XDIFF_PATCH_NORMAL (default mode, normal patch) or XDIFF_PATCH_REVERSE (reversed patch).

If error is passed then rejected parts are stored inside this variable.

Example 1. xdiff_string_patch() example

The following code applies changes to some article.

<?php
$old_article
= file_get_contents('./old_article.txt');
$diff = $_SERVER['patch']; /* Let's say that someone pasted a patch to html form */

$errors = '';

$new_article = xdiff_string_patch($old_article, $diff, XDIFF_PATCH_NORMAL, $errors);
if (
is_string($new_article)) {
    echo
"New article:\n";
    echo
$new_article;
}

if (
strlen($errors)) {
    echo
"Rejects: \n";
    echo
$errors;
}

?>

Returns a patched string.

See also xdiff_file_patch().

Php xdiff string patch Function syntax tag

xdiff string patch php code on this is provided for your study purpose, it will guide you to know how create and design a website using php. use it to practice and train your self online



Php xdiff string patch syntax tutorial

php tutorial guide and code design are for easy learning and programming. The code practice section provided at the top is for practising of this syntax. Use the code section up to practice your php programming online. Learning php is very easy, all you need is to use the examples on this site and practice them to perfect your skills.


Function index

Variables

Expressions

Operators

Control-Structures

Cookies

Array

Date & Time

Directory function

File

Image

Operators

Form data handling

Mathematics operators

Mail

Php Mysql

Network Functions

Strings

php tutorial guides,functions, classes, code examples and tags for creating simple dynamic site to mysql database driven sites
 
 
Htaccess    html   Php    javascript   Asp   css    maths  Past Questions  Practice Tests Online