I want to set a random background color on a css-class... I already got this PHP-Code:
<?php $color = sprintf(“#%06x”,rand(0,16777215)); ?>
This is my style.php:
<?php
header('Content-Type: text/css');
?>
body {
background: INSERT PHP COLOR HERE - BUT HOW?;
}
body {background-color: <?php echo $color; ?>;}Exactly the same as if you needed to insert it into HTML.sprintf()“#%06x”. You need real double quotes for PHP code."#%06x"