Implement a 'set' with PHP

software development


I am new to PHP. I’m interested in having a class called Set which, basically, is a glorified array which never contains duplicate values. This is either (1) a bad idea or (2) ground breaking ( probably (1) ) because I’ve googled and fumbled through PHP and PEAR and didn’t find any off-the-shelf stuff for a Set. Is there such a thing in existance? I’ve already started the class and it supports add(), remove(), size(), is_empty() and contains().

Is there an implementation of Set already in PHP? Am I completely nuts?

Check out my source if you’re interested at and there is a link to my simpletest unit test too.