function css2array($filename) {
$css = file_get_contents($filename);
$css = preg_replace('#/*(.*)*/#iu', '', $css);
preg_match_all('#(.*){(.*)}#isU', $css, $matches);
$cnt = sizeof($matches[1]);
$array = array();
for ($i = 1; $i < $cnt; $i++) {
$elm = array_filter(explode(';', trim($matches[2][$i])));
foreach($elm as $k => $v) {
$keyval = explode(':', $v);
$array[trim($matches[1][$i])][trim($keyval[0])] = trim($keyval[1]);
}
}
return $array;
}
echo '<pre>' . print_r(css2array('style.css'), 1);