Try this:
Keep refreshing the page and see how the colours change:
http://johns-jokes.com/downloads/sp-a/php-in-css/
Please note the site is cached. When viewing the source the additional code is due to Cloud Hosting. I would be very grateful if anyone knows how to disable this feature only on this page and not on the complete site.
file: style-001.php
<?php header("Content-type: text/css;charset:UTF-8");
$hex = mt_rand(0,17);
$x = sprintf('%x', $hex);
$bg0 = $x.$x.$x;
$bg1 = 'f' .$x .'f';
$bg2 = $x .'ff';
$bg3 = 'ff' .$x;
?>
body {background-color:#<?php echo $bg0;?> }
h1 {background-color:#<?php echo $bg1;?> }
h2 {background-color:#<?php echo $bg2;?> }
h3 {background-color:#<?php echo $bg3;?> }
div {width:88%; margin:1em auto; background-color:#eff; color:#000}
file: index.php
<?php /* */ ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Just Playing with PHP and CSS</title>
<link type="text/css" href="style-001.php" rel="stylesheet" />
</head>
<body>
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
<div>
<a href='http://www.sitepoint.com/forums/showthread.php?870800-Class-quot-clear-quot-pros-cons'>
Sitepoint discussion
</a>
<br /><br />
<?php highlight_file('style-001.php');?>
</div>
</body>
</html>