stream_isatty()

stream_isatty() — Check if a stream is a TTY.

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.

What it does

Determines if stream stream refers to a valid terminal type device. This is a more portable version of posix_isatty(), since it works on Windows systems too.

Signature

stream_isatty(resource $stream): bool

Parameters

ParameterTypeWhat it takes
$streamresource

Return value

Returns true on success or false on failure.

Example

The PHP manual ships no example for stream_isatty(); the signature and the parameter table above are the contract.

All PHP 8.5 built-in functions

Reference card built from the PHP manual page stream_isatty() (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.