I have an HTML string, and I want to remove from it all DIVs whose class is “toremove”.
This is trivial to do on the client side with jQuery etc., but I want to do it on the server side with PHP.
A simple aegular expression won’t work, because divs may be nested…
You could use the DOM object and xPath to remove the DIVs.
You can replace the load from file and save to file with load from and save to string if you prefer.