Diff
checker
テキスト
テキスト
画像
ドキュメント
Excel
フォルダ
Legal
Enterprise
デスクトップ
料金
ログイン
Diffchecker デスクトップのダウンロード
テキスト比較
2 つのテキスト ファイルの違いを見つける
ツール
履歴
ライブエディター
未変更行を折りたたむ
折り返しなし
レイアウト
分割
統合
比較精度
スマート
単語
文字
シンタックスハイライト
構文を選択
無視
テキスト変換
最初の差分へ移動
入力を編集
Diffchecker Desktop
Diffcheckerを実行する最も安全な方法。Diffchecker Desktopアプリを入手:あなたの差分はコンピューターから出ることはありません!
Desktopを入手
Untitled Diff
作成日
3 年前
差分は期限切れになりません
クリア
エクスポート
共有
説明
20 削除
行
合計
削除
文字
合計
削除
この機能を引き続き使用するには、アップグレードしてください
Diff
checker
Pro
価格を見る
23 行
すべてコピー
25 追加
行
合計
追加
文字
合計
追加
この機能を引き続き使用するには、アップグレードしてください
Diff
checker
Pro
価格を見る
21 行
すべてコピー
<?php
<?php
コピー
コピー済み
コピー
コピー済み
// Turn an array into a key=>value
pair.
Assumes the key is the first item in the sub-array.
// Turn an array into a key=>value
or key=>array
pair.
public function column
_i
nto
_k
eys(array $array): array {
//
Assumes the key is the first item in the sub-array.
public function column
I
nto
K
eys(array $array): array {
// get the name of the column that contains the record id
$key = key($array[0]);
// skip empty arrays
if (! count($array)) return [];
// loop through each result row
foreach($array as $row) {
foreach($array as $row) {
コピー
コピー済み
コピー
コピー済み
// pop the
new key
off the top of the array
// pop the
value of the row identifier
off the top of the array
$id = array_shift($row);
$id = array_shift($row);
// O(n)
//
is
there
only one item left in the array
?
//
if
there
is
only one item left in the array
...
if
(count($row) == 1)
$result[$id] =
(count($row) == 1)
//
get the first value
? current($row)
//
...
get the first value
$result[$id] = current(
$row
);
:
$row
;
//
...
get
the rest
of the
array
else
//
get
all
of the
values
$result[$id] = $row;
}
}
コピー
コピー済み
コピー
コピー済み
return $result;
return $result;
}
}
保存された差分
原文
ファイルを開く
<?php // Turn an array into a key=>value pair. Assumes the key is the first item in the sub-array. public function column_into_keys(array $array): array { // get the name of the column that contains the record id $key = key($array[0]); foreach($array as $row) { // pop the new key off the top of the array $id = array_shift($row); // is there only one item left in the array? if (count($row) == 1) // get the first value $result[$id] = current($row); else // get all of the values $result[$id] = $row; } return $result; }
変更されたテキスト
ファイルを開く
<?php // Turn an array into a key=>value or key=>array pair. // Assumes the key is the first item in the sub-array. public function columnIntoKeys(array $array): array { // skip empty arrays if (! count($array)) return []; // loop through each result row foreach($array as $row) { // pop the value of the row identifier off the top of the array $id = array_shift($row); // O(n) // if there is only one item left in the array... $result[$id] = (count($row) == 1) ? current($row) // ...get the first value : $row; // ...get the rest of the array } return $result; }
違いを見つける