Search code examples
phpgraph-theoryrbacset-theory

implementing set theory operations in php


How to implement set theory operations in pure php?


Solution

  • Which operations are you looking for? What are you trying to accomplish?

    In PHP an array is (imperfectly) analogous to a set, and PHP has array_intersect, array_merge (union), and array_diff (complement) functions built in. There's also array_uintersect and array_udiff for handling complex objects whose comparisons are not so straightforward.

    Is there further functionality you need?