Ok, I tried this myself, and it works, so there's something in your code you are missing.
1 - Make sure you are linking to your stylesheet, be sure this is in the <HEAD> of your document:
<LINK REL="stylesheet" TYPE="text/css" HREF="PATH_TO_CSS">
2 - Make sure the stylesheet is readable to the world:
chmod 644 stylesheet.css
3 - Your array will look something like this:
$realm_array = array("slist","alist","mlist","hlist","tlist");
4 - Your <P> tag will look something like this:
<P CLASS=$realm_array[$id]> </P>
Heres is an example of some code that prints out 5 "Hello's" using the stylesheet to change each color.
echo "<HEAD>";
echo "<LINK REL=\"stylesheet\" TYPE=\"text/css\" HREF=\"http://orst.edu/~cushmana/test.css\">";
echo "</HEAD>";
$realm_array = array("slist","alist","mlist","hlist","tlist");
echo "<P CLASS=\"$realm_array[0]\">Hello</P>";
echo "<P CLASS=\"$realm_array[1]\">Hello</P>";
echo "<P CLASS=\"$realm_array[2]\">Hello</P>";
echo "<P CLASS=\"$realm_array[3]\">Hello</P>";
echo "<P CLASS=\"$realm_array[4]\">Hello</P>";
If this doesnt work, show me more of your code, and what you are trying to do on it. This does work, it just needs to be implemented right.