convert html code into chunks in php