Some tips on dynamically generating CSS from PHP. Note this first code trick by changing the content type:

< ?php
header('Content-type: text/css');
?>

Read full article: Variables in your CSS via PHP