Example 1 — Memory Streams Are Not TTYs
Open php://memory and show that stream_isatty() returns false.
<?php
$fp = fopen("php://memory", "r+");
echo stream_isatty($fp) ? "tty" : "not tty", PHP_EOL;
fclose($fp); How It Works
- A memory stream is opened.
- stream_isatty() checks whether that handle is a terminal.
- php://memory is never a TTY, so the result is false.
- The script prints not tty.

