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 require __DIR__ . '/../vendor/autoload.php';



if (!defined('SIGINT')) {

    fwrite(STDERR, 'Not supported on your platform (ext-pcntl missing or Windows?)' . PHP_EOL);

    exit(1);

}
<?php require __DIR__ . '/../vendor/autoload.php';



if (!defined('STDIN') || stream_set_blocking(STDIN, false) !== true) {

    fwrite(STDERR, 'ERROR: Unable to set STDIN non-blocking (not CLI or Windows?)' . PHP_EOL);

    exit(1);

}
<?php $data = str_repeat($data, round(200000 / strlen($data)));



if (!defined('STDOUT') || stream_set_blocking(STDOUT, false) !== true) {

    fwrite(STDERR, 'ERROR: Unable to set STDOUT non-blocking (not CLI or Windows?)' . PHP_EOL);

    exit(1);

}
<?php     public function testAddWriteStreamTriggersWhenSocketConnectionRefused()

    {

        if (defined('HHVM_VERSION')) {

            $this->markTestSkipped('Not supported on HHVM');

        }
<?php         $errno = $errstr = null;

        if (@stream_socket_client('127.0.0.1:1', $errno, $errstr, 10.0) !== false || (defined('SOCKET_ECONNREFUSED') && $errno !== SOCKET_ECONNREFUSED)) {

            $this->markTestSkipped('Expected host to refuse connection, but got error ' . $errno . ': ' . $errstr);

        }
<?php     public function setUpBin()

    {

        if (!defined('PHP_BINARY') || defined('HHVM_VERSION')) {

            $this->markTestSkipped('Tests not supported on legacy PHP 5.3 or HHVM');

        }