How to implement set theory operations in pure php?
What kind of surgery are you looking for? What are you trying to accomplish?
In PHP, an array is (imperfectly) similar to a set, and PHP has array_intersect , array_merge (union) and array_diff (addition) built-in functions. array_uintersect and array_udiff to handle complex objects, comparison is not so simple.
array_intersect
array_merge
array_diff
array_uintersect
array_udiff
Are additional features needed?
You have probably already seen these links:
http://jamietalbot.com/2010/02/04/set-operations-in-php/
http://oreilly.com/catalog/progphp/chapter/ch05.html