sapi_windows_vt100_support

PHP 7 >= 7.2.0, PHP 8
sapi_windows_vt100_support - Get or set VT100 support for the specified stream associated to an output buffer of a Windows console.
Manual
Code Examples

sapi_windows_vt100_support( resource$stream, [bool|null$enable = null] ): bool

If enable is null, the function returns true if the stream stream has VT100 control codes enabled, false otherwise.

If enable is a bool, the function will try to enable or disable the VT100 features of the stream stream. If the feature has been successfully enabled (or disabled), the function will return true, or false otherwise.

At startup, PHP tries to enable the VT100 feature of the STDOUT/STDERR streams. By the way, if those streams are redirected to a file, the VT100 features may not be enabled.

If VT100 support is enabled, it is possible to use control sequences as they are known from the VT100 terminal. They allow the modification of the terminal's output. On Windows these sequences are called Console Virtual Terminal Sequences.

Warning:

This function uses the ENABLE_VIRTUAL_TERMINAL_PROCESSING flag implemented in the Windows 10 API, so the VT100 feature may not be available on older Windows versions.

Parameters

stream

The stream on which the function will operate.

enable

If bool, the VT100 feature will be enabled (if true) or disabled (if false).

Return Values

If enable is null: returns true if the VT100 feature is enabled, false otherwise.

If enable is a bool: Returns true on success or false on failure.

Changelog

Version Description
8.0.0 enable is now nullable.

Example of sapi_windows_vt100_support

Show all examples for sapi_windows_vt100_support

PHP Version: