Mouse [3] => Monitor ) */ // Find items in the customer's order that are NOT in stock $productsOrderedButNotInStock = array_diff($customerOrder, $availableProducts); echo " Products ordered but not in stock: "; print_r($productsOrderedButNotInStock); /* Output: Array ( [3] => Headphones ) */ $userPermissionsA = ['read', 'write', 'delete']; $userPermissionsB = ['read', 'create', 'write']; // Permissions unique to User A $uniqueToUserA = array_diff($userPermissionsA, $userPermissionsB); echo " Permissions unique to User A: "; print_r($uniqueToUserA); /* Output: Array ( [2] => delete ) */ // Permissions unique to User B $uniqueToUserB = array_diff($userPermissionsB, $userPermissionsA); echo " Permissions unique to User B: "; print_r($uniqueToUserB); /* Output: Array ( [1] => create ) */ // Example with associative arrays, comparing keys AND values $userProfileOld = ['id' => 1, 'name' => 'Jane Doe', 'email' => 'jane@example.com', 'status' => 'active']; $userProfileNew = ['id' => 1, 'name' => 'Jane Smith', 'email' => 'jane@example.com', 'role' => 'admin']; // array_diff_assoc compares both keys and values $changedProperties = array_diff_assoc($userProfileOld, $userProfileNew); echo " Properties changed or present only in old profile (key-value comparison): "; print_r($changedProperties); /* Output: Array ( [name] => Jane Doe [status] => active ) */ ?>