* ``` * * @internal */ final class PhpInfoViewHelper extends AbstractViewHelper { /** * @var bool */ protected $escapeOutput = false; /** * @var bool */ protected $escapeChildren = false; public function render(): string { return self::removeAllHtmlOutsideBody(self::changeHtmlToHtml5(self::getPhpInfo())); } /** * Get information about PHP's configuration as HTML string */ private static function getPhpInfo(): string { ob_start(); phpinfo(); return (string)ob_get_clean(); } /** * Remove all HTML outside the body tag from HTML string. */ private static function removeAllHtmlOutsideBody(string $html): string { // Delete anything outside the body tag and the body tag itself $html = (string)preg_replace('/^.*?