Skip to content Skip to sidebar Skip to footer

Changing The Color Of PHP Text

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.

Solution 1:

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/


Solution 2:

Sure :

<?php

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

?>

Post a Comment for "Changing The Color Of PHP Text"