Example of density based clustering algorithm DBSCAN in PHP
DBSCAN is a density based clustering algorithm, see http://en.wikipedia.org/wiki/DBSCAN for more details.
Some great features of DBSCAN, and density based clustering methods in general, are that you don't need to specify the number of clusters as a parameter and every point does not need to belong to a cluster as would be the case in k-means for example. DBSCAN will also find non-spherical, arbitrarily shaped clusters.
See index.php for example of how to use.