xdiff_string_patch/とは? わかりやすく解説

Weblio 辞書 > コンピュータ > PHP関数リファレンス > xdiff_string_patch/の意味・解説 

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 を適用します。
flagsXDIFF_PATCH_NORMAL(デフォルト。通常のパッチ)あるいは XDIFF_PATCH_REVERSE(逆パッチ) のいずれかです。
error が渡された場合、パッチを拒否された部分が この変数に保存されます。
例 2453. 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() も参照ください。



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「xdiff_string_patch/」の関連用語

xdiff_string_patch/のお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



xdiff_string_patch/のページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
PHP Documentation GroupPHP Documentation Group
Copyright © 1997 - 2024 by the PHP Documentation Group.

©2024 GRAS Group, Inc.RSS