Possible Duplicate:
PHP “pretty print” HTML (not Tidy)
Lets say I have php var contains this string :
<html><head><title>Page title</title></head><body><div>content here</div></body></html>
How I can to format this html code with php ? When I say format I mean to add line breaks and add tabs to this code to be like :
<html>
<head>
<title>Page title</title>
</head>
<body>
content here
</body>
</html>
I know there is tidy extension to php , but I need an alternative solution for that.
Thanks.
` tag and that of the `
` tag? Let aside a script, how can a person know why the former is stuck inside the tags whereas the latter is located in a separate line and tabbed at first place? Also, if you're sure it's gonna be strict html then I would suggest you to parse it as XML instead.
– inhan Dec 22 '12 at 14:57