-5

I was wondering if you can change the colour of your print and echo text so that when it is displayed on your HTML page it's not simply in black? Cheers.

The-Rizzler
  • 41
  • 2
  • 4
  • 1
    Yes. But you'll have to do it with HTML/CSS. Emit the information between a pair of tags that you apply some styling rules to. – Cᴏʀʏ Mar 24 '14 at 22:08
  • Possible duplicate of [PHP Echo text Color](http://stackoverflow.com/questions/1691646/php-echo-text-color) – 13ruce1337 Mar 24 '14 at 22:10

2 Answers2

2

If you're doing this in html, always.

<?php echo "<span style='color:blue;'>blue text</span>"; ?>

If you're doing this in command line, it's a bit different. You'd need to create a library or find an existing one. Example: http://www.if-not-true-then-false.com/2010/php-class-for-coloring-php-command-line-cli-scripts-output-php-output-colorizing-using-bash-shell-colors/

skrilled
  • 5,350
  • 2
  • 26
  • 48
1

Sure :

<?php

echo "<p style='color:blue'> Hello ! </p>";

?>
Loïc
  • 11,804
  • 1
  • 31
  • 49