$set1 = [1, 2, 3]; $set2 = [2, 3, 4]; $intersection = array_intersect($set1, $set2); print_r($intersection);
Array ( [1] => 2 [2] => 3 )
$set1 = [1, 2, 3]; $set2 = [2, 3, 4]; $difference = array_diff($set1, $set2); print_r($difference);
Array ( [0] => 1 )
$set1 = [1, 2, 3]; $set2 = [2, 3, 4]; $union = array_merge($set1, $set2); print_r($union);
Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 2 [4] => 3 [5] => 4 )This shows that the union of the two sets is `[1, 2, 3, 2, 3, 4]`. In the examples above, we used PHP's built-in array functions to perform set operations. Therefore, we don't need to use any specific package library such as PHP Set Matches.