Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP Echo text Color

Tags:

How do I change the color of an echo message and center the message in the PHP I've written. The line I have is:

echo 'Request has been sent. Please wait for my reply!';

like image 346
The Woo Avatar asked Nov 07 '09 01:11

The Woo


People also ask

How can I change the color of text in PHP?

PHP doesn't have built-in functionality for changing the font size or color. We can use HTML and CSS with PHP to change the font size and color.

What does the echo statement do in PHP?

The echo is used to display the output of parameters that are passed to it. It displays the outputs of one or more strings separated by commas. The print accepts one argument at a time & cannot be used as a variable function in PHP.

What is the difference between echo and print in PHP?

echo and print are more or less the same. They are both used to output data to the screen. The differences are small: echo has no return value while print has a return value of 1 so it can be used in expressions.

How do you color text in HTML?

To set the font color in HTML, use the style attribute. The style attribute specifies an inline style for an element. The attribute is used with the HTML <p> tag, with the CSS property color. HTML5 do not support the <font> tag, so the CSS style is used to add font color.


1 Answers

How about writing out some escape sequences?

echo "\033[01;31m Request has been sent. Please wait for my reply! \033[0m"; 

Won't work through browser though, only from console ;))

like image 176
kolypto Avatar answered Sep 24 '22 08:09

kolypto