I have a command, for example 'git diff' that output a colorized result when I run it from the terminal.
Now, I want to call that command from a CLI php script and display in the console the colorized result. I have try with exec(), system(), passthru() but in all case the output has been converted to plain black and white text.
Is there a way to preserve the color of the standard result? If not, does someone know why this information get lost?
env > env_a.out && php -r 'system("env");' > env_b.out && diff env_a.out env_b.outphp -r 'printf("%c[32mGreen%c[0m\n", 27, 27);') rather than from invoking a command like git.