Every path through the PHP code might generate a different HTML page.
I generally take a few variants of each success case and run them through the W3C HTML validator every release … and at best I can hope to cover 20% of the pages which my code might generate.
This sounds like a tall order, but is there any tool which can at least reduce the amount of invalid HTML which my code might produce? Even just catching my favourite <p. instead of <p> would be a boon.
I can see how tough it would be … even catching missing end tags might mean parsing through if ... else or switch logic in PHP …
I think I just answered my own question … but …
Have a look at PHP’s Tidy