Midwest PHP Call For Papers Open

stream_isatty

(PHP 7 >= 7.2.0)

stream_isattyCheck if a stream is a TTY

Descrição

stream_isatty ( resource $stream ) : bool

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.

Parâmetros

stream

Valor Retornado

Retorna TRUE em caso de sucesso ou FALSE em caso de falha.

Exemplos

Exemplo #1 stream_isatty() example

This command can be used to determine if a standard output / standard error stream is redirected to a file.

php -r "var_export(stream_isatty(STDERR));"

O exemplo acima irá imprimir algo similar à:


true
php -r "var_export(stream_isatty(STDERR));" 2>output.txt

O exemplo acima irá imprimir algo similar à:


false

add a note add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top