I've already made a function which takes an input string representing a HTML document and validates it locally.
I'm trying to auto-validate my own PHP-generated webpages with it.
Can PHP store its own full output in a $string so that it can send this to my validator function in the very end, after all output is done?
Yup!
https://www.php.net/manual/en/function.ob-start.php
https://www.php.net/manual/en/function.ob-get-contents.php
Basically: