Diff
checker
Texto
Texto
Imagens
Documentos
Excel
Pastas
Legal
Enterprise
Aplicativo para desktop
Preços
Fazer login
Baixar o Diffchecker Desktop
Comparar texto
Encontre a diferença entre dois arquivos de texto
Ferramentas
Histórico
Editor live
Recolher inalteradas
Sem quebra de linha
Layout
Dividido
Unificado
Nível de detalhe
Inteligente
Palavra
Caractere
Realce de sintaxe
Escolher sintaxe
Ignorar
Transformar texto
Ir à primeira mudança
Editar entrada
Diffchecker Desktop
A maneira mais segura de usar o Diffchecker. Obtenha o aplicativo Diffchecker Desktop: seus diffs nunca saem do seu computador!
Obter Desktop
Untitled Diff
Criado
há 3 anos
O diff nunca expira
Limpar
Exportar
Compartilhar
Explicar
20 remoções
Linhas
Total
Removido
Caracteres
Total
Removido
Para continuar usando este recurso, atualize para
Diff
checker
Pro
Ver preços
23 linhas
Copiar tudo
25 adições
Linhas
Total
Adicionado
Caracteres
Total
Adicionado
Para continuar usando este recurso, atualize para
Diff
checker
Pro
Ver preços
21 linhas
Copiar tudo
<?php
<?php
Copiar
Copiado
Copiar
Copiado
// 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) {
Copiar
Copiado
Copiar
Copiado
// 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;
}
}
Copiar
Copiado
Copiar
Copiado
return $result;
return $result;
}
}
Diferenças salvas
Texto original
Abrir arquivo
<?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; }
Texto alterado
Abrir arquivo
<?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; }
Encontrar Diferença