I have to use an old version of PHP while updating a production application to a modern version. My Windows 10 development machine has PHP 7.3 on it, but the old application needs PHP 5.5.
My testing framework outputs in colour which is really helpful for quickly detecting if any tests fail. However, with PHP 5.5, the output messages are interleaved with the ANSI code making them very hard to read.
PHP 7.3 can render text to the console using ANSI colours, but the same code in PHP 5.5 produces the ANSI sequences in the output instead of setting the colours. If I use ANSICON instead of the built-in command prompt, both PHP 5.5 & PHP 7.3 can output in colour.
Why is the only combination that fails to display in colour PHP 5.5 + the Command Prompt?
Command Prompt
C:\>php55 -r "echo """\x1B[36mCyan\x1B[0m""";"
[36mCyan[0m
C:\>php73 -r "echo """\x1B[36mCyan\x1B[0m""";"
Cyan
ANSI Console
C:\>php55 -r "echo """\x1B[36mCyan\x1B[0m""";"
Cyan
C:\>php73 -r "echo """\x1B[36mCyan\x1B[0m""";"
Cyan