<?php/** * Simpler version without pretty print config options. */function tidy_html5($html, array $config = [], $encoding = 'utf8') { $config += [ 'doctype' => '<!DOCTYPE html>', 'drop-empty-elements' => 0, 'new-blocklevel-tags' => 'article aside audio bdi canvas details dialog figcaption figure footer header hgroup main menu menuitem nav section source summary template track video', 'new-empty-tags' => 'command embed keygen source track wbr', 'new-inline-tags' => 'audio command datalist embed keygen mark menuitem meter output progress source time video wbr', 'tidy-mark' => 0, ]; $html = tidy_parse_string($html, $config, $encoding); // doctype not inserted tidy_clean_repair($html); // doctype inserted return $html;}$html = '</z><p><a href="#">Link</a></p><p><img src="logo.png"/>Seçond para</p><i class="fa"></i><p></p>';echo tidy_html5($html);<!DOCTYPE html><html><head><title></title></head><body><p><a href="#">Link</a></p><p><img src="logo.png">Seçond para</p><i class="fa"></i><p></p></body></html>echo tidy_html5($html, ['indent'=>2, 'indent-spaces'=>4]);<!DOCTYPE html><html><head> <title></title></head><body> <p><a href="#">Link</a></p> <p><img src="logo.png">Seçond para</p><i class="fa"></i> <p></p></body></html>echo tidy_html5($html, ['indent'=>1], 'ascii');<!DOCTYPE html><html> <head> <title></title> </head> <body> <p> <a href="#">Link</a> </p> <p> <img src="logo.png">Seçond para </p><i class="fa"></i> <p></p> </body></html>echo tidy_html5($html, ['show-body-only'=>1]);<p><a href="#">Link</a></p><p><img src="logo.png">Seçond para</p><i class="fa"></i><p></p>