0

I have a following code in script.php:

<?php
echo "\e[0;36m Be happy ;)\e[0m";
?>

It is run like this:

~$ php script.php

On my linux mint desktop the output is colorized but on the remote server machine it is not, but when I use bash there:

~$ echo -e "\e[0;36m Be happy ;)\e[0m";

I have colorized output... I have no idea what could be wrong.

Please help.

1
  • I need echo "\033[0;36m Be happy ;)\033[0m"; here, for some reason \e will not work, unless I pipe it trough echo -e. I'm sure it's a configuration somewhere... Commented May 15, 2013 at 17:24

1 Answer 1

2

Aha, found it:

\e escape (ESC or 0x1B (27) in ASCII) (since PHP 5.4.0)

< php 5.4.0. use "\033" instead of "\e"

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.