Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Checks whether a constant with the given name exists
<?php defined(string $constant_name): bool
<?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);