使用laravel检测两个阵列之间的差异

I have two arrays and I need to verify what is different between them, like:
Something exists in array A but not in B,
One argument is diferent in array A when comparing to B...

$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();
        }

When I do:

 print_r($turmas->toArray()); 
 print_r($temp->toArray());   

I get:
enter image description here

How may I compare these keys and identify when something changed is new or is missing.

Tried working with array_diff_assoc but I get the following error:

Array to string conversion

array_diff_assoc($temp->toArray(),   $turmas->toArray());  

Also tried This that I found in another answer in a similar question but didn't work.

First define your own function to compare arrays:

function arrayCmp($a, $b) {
    if ($a < $b) {
        return -1;
    } elseif ($a > $b) {
        return 1;
    } else {
        return 0;
    }
}

Then if you want elements that are present in $a bot not in $b then you call:

$diff = array_udiff($a, $b, 'arrayCmp');