Hello!
I wanted to ask if someone ever managed to give the output of a PHP script on commandline a different color? Like highlighted syntax.
I know there is a syntax for colors on bash, and I know you can use Windows Powershell to echo different colored strings, but how can I use them in PHP? I mean when I echo the color syntax for bash it will only display the syntax, but not execute it. Same goes for Powershell commands like "Write-Host -ForegroundColor Red "redtext"".
I've already tried fwrite(STDOUT, 'Write-Host -ForegroundColor Red "redtext"') too, but that doesnt work either. And I cant use exec or alike because it doesnt show me the output directly on the commandline I started the php script from.
I'm really stuck here, although I'm sure someone else did on the same problem before and maybe has a workaround?
To conclude:
I want to use the following PHP code
echo "text <code>text</code> text";
on any OS you want, which gives me the output
text text text
while the text in the middle is colored. I just dont know what "code" I need.
Thanks for reading,
Reiners