array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'es', ), 'this' => array ( 0 => 'function.stream-isatty.php', 1 => 'stream_isatty', ), 'up' => array ( 0 => 'ref.stream.php', 1 => 'Funciones de Flujos', ), 'prev' => array ( 0 => 'function.stream-is-local.php', 1 => 'stream_is_local', ), 'next' => array ( 0 => 'function.stream-notification-callback.php', 1 => 'stream_notification_callback', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/stream/functions/stream-isatty.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 7 >= 7.2.0, PHP 8)
stream_isatty — Check if a stream is a TTY
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.
stream
Ejemplo #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));"
El resultado del ejemplo sería algo similar a:
php -r "var_export(stream_isatty(STDERR));" 2>output.txt
El resultado del ejemplo sería algo similar a: