xdiff_string_patch
    (PECL)
xdiff_string_patch -- 
     文字列に unified diff 形式のパッチを適用する
    
説明
string 
xdiff_string_patch ( string str, string patch [, int flags [, string &error]] )
     xdiff_string_patch() は、文字列
     str に unified 形式のパッチ文字列
     patch を適用します。
    
     flags は
     XDIFF_PATCH_NORMAL(デフォルト。通常のパッチ)あるいは
     XDIFF_PATCH_REVERSE(逆パッチ)
     のいずれかです。
    
     error が渡された場合、パッチを拒否された部分が
     この変数に保存されます。
    
例 1. xdiff_string_patch() の例 
      以下のコードは、ある記事に対して変更を適用します。
      
<?php $old_article = file_get_contents('./old_article.txt'); $diff = $_SERVER['patch']; /* だれかが html フォームからパッチを投稿したとしましょう */
  $errors = '';
  $new_article = xdiff_string_patch($old_article, $diff, XDIFF_PATCH_NORMAL, $errors); if (is_string($new_article)) {     echo "新しい記事:\n";     echo $new_article; }
  if (strlen($errors)) {     echo "Rejects: \n";     echo $errors; }
  ?>
 |  
  | 
     パッチ適用後の文字列を返します。
    
     xdiff_file_patch() も参照ください。