sapi_windows_vt100_support()
sapi_windows_vt100_support() — Get or set VT100 support for the specified stream associated to an output buffer of a Windows console..
Built-in function of PHP 8.5. The manual lists it as available in PHP 7 >= 7.2.0, PHP 8. This page is the reference card: signature, parameters and return value, plus the changelog and the example the manual provides.
Signature
sapi_windows_vt100_support(resource $stream, ?bool $enable = null): bool
Parameters
| Parameter | Type | What it takes |
|---|---|---|
| $stream | resource | The stream on which the function will operate. |
| $enable | ?bool | If bool, the VT100 feature will be enabled (if true) or disabled (if false). |
Return value
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.
Example
A runnable snippet:
$out = fopen('php://stdout','w'); fwrite($out, 'Just forgot a lettr.'); // Moves the cursor two characters backwards fwrite($out, "\033[2D"); // Inserts one blank, shifting existing text to the right -> Just forgot a lett r. fwrite($out, "\033[1@"); fwrite($out, 'e');
Output:
Just forgot a letter.
Changelog
| Version | Change |
|---|---|
| 8.0.0 | enable is now nullable. |
All PHP 8.5 built-in functions
Reference card built from the PHP manual page sapi_windows_vt100_support() (PHP documentation, CC BY 3.0). The page is generated from the manual, so the wording of the parameter and return value text follows php.net.