etrader Posted March 31, 2011 Share Posted March 31, 2011 In my php and html code I have lots of whitespace and line breaks between the <tags>. How I can remove all useless whitespace and linebreaks without altering the main text and codes? Quote Link to comment https://forums.phpfreaks.com/topic/232321-removing-whitespace-from-code/ Share on other sites More sharing options...
Maq Posted March 31, 2011 Share Posted March 31, 2011 Get an IDE that has auto-formatting. Quote Link to comment https://forums.phpfreaks.com/topic/232321-removing-whitespace-from-code/#findComment-1195146 Share on other sites More sharing options...
etrader Posted March 31, 2011 Author Share Posted March 31, 2011 how to use this code? I have a set of php processes ending to a series of echo for strings. I put this code at the beginning and at the end of the whole code, but no effect Quote Link to comment https://forums.phpfreaks.com/topic/232321-removing-whitespace-from-code/#findComment-1195168 Share on other sites More sharing options...
Maq Posted March 31, 2011 Share Posted March 31, 2011 how to use this code? I have a set of php processes ending to a series of echo for strings. I put this code at the beginning and at the end of the whole code, but no effect Sorry, are you referring to the actual code, or the result of your code? Quote Link to comment https://forums.phpfreaks.com/topic/232321-removing-whitespace-from-code/#findComment-1195171 Share on other sites More sharing options...
etrader Posted April 1, 2011 Author Share Posted April 1, 2011 Image some string which get content from an external webpage and displaying them with echo. Now, there are lots of useless whitespace between the codes. e.g. $string1=file_get_content(http://external.com); $string2 ='<some code> </div>' echo $string1; echo $string2; Quote Link to comment https://forums.phpfreaks.com/topic/232321-removing-whitespace-from-code/#findComment-1195385 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.