Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Opens file or URL
<?php fopen(    string $filename,    string $mode,    bool $use_include_path = false,    ?resource $context = null): resource|false
<?php     {

        static $isTtySupported;



        $input = (defined('STDIN') ? STDIN : fopen('php://input', 'r+'));



        if ($isTtySupported === null && function_exists('proc_open')) {

            $isTtySupported = (bool) @proc_open('echo 1 >/dev/null', [['file', '/dev/tty', 'r'], ['file', '/dev/tty', 'w'], ['file', '/dev/tty', 'w']], $pipes);
<?php     private function hasVt100Support(): bool

    {

        return function_exists('sapi_windows_vt100_support') && sapi_windows_vt100_support(fopen('php://stdout', 'w'));

    }