Jump to content

changing colors


Jay2391

Recommended Posts

I have this echo statement I want $r_win - $r_loss - $r_tie to be in

blue - red and green fonts...can i do that ????

[code]
echo "<pre>";
  printf ("<h5>%-20s%-20s%-20s%-20s%-20s \n", "$r_user_name", "$r_win - $r_loss - $r_tie", "$r_rank", "$r_eliminated", "$r_final_result", "<br></h5>");     
echo "</pre>";
[/code]
Link to comment
https://forums.phpfreaks.com/topic/35525-changing-colors/
Share on other sites

You certainly can though its not really anything to do with PHP all you do is attach html elements to either side of your variable and give them a colour. For example,

[code=php:0]
$text = "my text should be red";

echo "<font color='red'>".$text."</font>";
[/code]

Personally I would use span tags and CSS to do this as I hate font tags but its a quick example.
Link to comment
https://forums.phpfreaks.com/topic/35525-changing-colors/#findComment-168199
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.