Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function FindUniqueElements($arr1, $arr2) {
- $arr1 =SortAny($arr1);
- $arr2 = SortAny($arr2);
- $arr1withoutArr2 = [];
- for ($i=0; $i<=CountAr($arr1) && $arr1[$i] == $arr1[$i+1]; $i++){
- $found = false;
- for ($j=0; $j <= CountAr($arr2) && $arr2[$j] == $arr2[$j+1]; $j++){
- if ($arr1[$i] === $arr2[$j]){
- $found = true;
- break;
- }
- }
- if (!$found){
- $arr1withoutArr2[] = $arr1[$i];
- }
- }
- print_r($arr1withoutArr2);
- }
- echo FindUniqueElements($arr1, $arr2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement