<?php
function rand_color() {
$r = str_pad(dechex(rand(0, 255)), 2, '0', STR_PAD_LEFT);
$g = str_pad(dechex(rand(0, 255)), 2, '0', STR_PAD_LEFT);
$b = str_pad(dechex(rand(0, 255)), 2, '0', STR_PAD_LEFT);
return '#'.$r.$g.$b;
}
echo '<div style="background: '.rand_color().';height:600px">treść</div>';