Code optimizer PHP, Javascript, CSS
03.11.2011 14:51:55 In general, faced with the task to optimize the code a bit before pouring it on hosting.Actually it took me no, and a friend decided to take the case. At the end you can download the source script.
At first thought it was worth cutting out all unnecessary code, including all kinds of comments, but then came to the conclusion that the html cut, in some cases dangerous, because they can be used in special cases (a good example of my informers technology), other types of comments, too, decided not to cutbecause of the possibility of matching characters in the values of variables and regular expressions.Well, it makes no sense to spoil the working code and then can not find where the error occurred.
So you only remove spaces, tabs, and blank lines, modestly but with no risk.
In PHP, there is an interesting function file(), it allows you to read a text file into an array of strings, I used this opportunity to recursively read files from a folder and process line using the trim(). In general, the task was fairly simple.
To use the script to unzip the file and put it in the root of localhost, in the index.php file, change the path to the folder in which the processing will occur.
For unix like systems should be set on the folder permissions 777 "o" and all its contents it is necessary that the script can overwrite the files. In Windows, this should not be there right there.
Once you put your files in the folder "o" to run the index.php from your browser, if you got out error means the permissions are set incorrectly. Only process files with php, css, js.
I think you expand the list to not be a problem.
Another note: Try not to handle too many files at once, but otherwise we will have more time to script execution.
Download PHP code optimizer.
Рейтинг $r-- [2] $r++
Показать коментарии (vkontakte.ru)}