What is the difference between the neat functions parseString (), repairString (), cleanRepair ()

I just started using it neatly, but the functions parseString() , repairString() , cleanRepair() confuse me with it. I went through the php.net manual and other sites, but can I get it? the php manual states that parseString() parses the document stored in the string, and repairString() restores the document stored in the string. But what is the difference between parsing and repair. both accept optional parameters, and they can be assigned the same parameters, what's the difference? when to use which function and when both? I saw in the textbook, he used both functions. can anyone help? also point to useful links if you know. Thanks

+4
source share
1 answer

parseString takes a string and creates a new tidy instance. cleanRepair cleans and restores the contents of this tidy instance. You can then get the finished HTML by converting a tidy instance, for example. echo .

repairString basically does it all in one go. This combination of actions is the most common option, so this is a quick access method. Note that it returns a string, while parseString returns a new tidy instance, and cleanRepair returns a boolean value to indicate whether the operation was successful.


So this is the (approximately) equivalent:

 $tidy = new Tidy; $tidy->parseString($yourHTML); $tidy->cleanRepair(); echo $tidy; $tidy = new Tidy; echo $tidy->repairString($yourHTML); 
+5
source

All Articles