<?php $arr1[0] = ['user_id' => 1, 'username' => 'bob']; $arr1[1] = ['user_id' => 2, 'username' => 'tom']; //and $arr2[0] = ['user_id' => 2, 'username' => 'tom']; $arr2[1] = ['user_id' => 3, 'username' => 'john']; $arr2[2] = ['user_id' => 21, 'username' => 'taisha']; $arr2[3] = ['user_id' => 1, 'username' => 'bob']; var_export ( array_udiff( $arr2, $arr1, fn($a, $b) => $a <=> $b ) );
You have javascript disabled. You will not be able to edit any code.