Following up on the start of his port of the Hamcrest (a library of "matchers") functionality over to PHP, Sebastian Bergmann has posted the getting started guide to show you how to use it with the popular PHPUnit unit testing software.
There are a number of situations where matchers are invaluble, such as UI validation, or data filtering, but it is in the area of writing flexible tests that matchers are most commonly used.
His example that checks to see if one object is equal to another object. The Hamcrest matcher allows for a "assertThat" method making it easier to create and use pre-existing unit testing assertions.
He also includes a list of some of the most common matchers broken up into groups of core, logical, object, number and text.