PHP Minify css calc code example
Example: php function to minify javascript and css
$css = '';
$root = $_SERVER['DOCUMENT_ROOT'].'/css/';
$files = explode(',',$_SERVER['QUERY_STRING']);
if(sizeof($files))
{
foreach($files as $file)
{
$css.= (is_file($root.$file.'.css') ? file_get_contents($root.$file.'.css') : '');
}
}
return str_replace('; ',';',str_replace(' }','}',str_replace('{ ','{',str_replace(array("\r\n","\r","\n","\t",' ',' ',' '),"",preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!','',$css)))));