0
を使用して、2つのアレイ間の差を検出私が行うと... Bに私は2つの配列を持っていると私は同じように、それらの間の異なる何であるかを確認する必要がありlaravel
$temp = import_temp::select('cod_disciplina', 'cod_turma', 'hr_inicio', 'hr_fim', 'dia_semana')->get();
$turmas;
foreach($temp as $t)
{
$turmas = Horario::select('cod_disciplina', 'cod_turma', 'hr_inicio', 'hr_fim', 'dia_semana')
->whereIn('cod_disciplina', $temp->lists('cod_disciplina'))
->whereIn('cod_turma', $temp->lists('cod_turma'))
->where('ano_semestre', $ano_semestre)->get();
}
を比較:
print_r($turmas->toArray());
print_r($temp->toArray());
これらのキーを比較して、changed
がnew
またはmissing
であることを確認するにはどうすればよいですか。
はarray_diff_assoc
で作業しようとしましたが、私は次のエラーを取得:
Array to string conversion
array_diff_assoc($temp->toArray(), $turmas->toArray());
はまたThis that I found in another answer in a similar questionを試みたが、うまくいきませんでした。
を私はすべて何を持っている場合これらの要素のうちの1つまたは複数の要素の両方の内部の要素には、異なる値があります。 – PlayHardGoPro
あなたが言ったことは矛盾です。いくつかの要素が異なる値を持つ場合、それらは異なる要素であり、両方の内部にあることはできません。 –