Panos
Panos

Reputation: 52

Give colour to PHP string

Hello everyone I am trying one very simple thing but unfortunately for a reason that I don't get I can't have the desired result.I am trying to colourize a string everytime that is beign generated. I am running the example to an online interpreter and this is what I get back.

<?php
     echo "<p style='color:red;'>Hello Wolrld</p>";
?>

Result :

<p style='color:red;'>Hello Wolrld</p>

The whole thing is treated as a string from the echo which seems ok but I don't know how to structure or write it in order to get back the word Hello World in red.

Thank you very much

Upvotes: 0

Views: 126

Answers (1)

unalignedmemoryaccess
unalignedmemoryaccess

Reputation: 7441

Code works ok. Interpreter does not show PHP output properly, but shows HTML code encoded.

If you will try that code in your local server (XAMPP, or similar) it will work OK. It is a problem on interpreter side.

Upvotes: 3

Related Questions