get_defined_constants

Supported Versions: PHP 4 >= 4.1.0, PHP 5, PHP 7, PHP 8
Returns an associative array with the names of all the constants and their values
<?php get_defined_constants(bool $categorize = false): array
<?php     public static function errno($errstr)

    {

        if (\function_exists('socket_strerror')) {

            foreach (\get_defined_constants(false) as $name => $value) {

                if (\strpos($name, 'SOCKET_E') === 0 && \socket_strerror($value) === $errstr) {

                    return $value;

                }
<?php     public static function errconst($errno)

    {

        if (\function_exists('socket_strerror')) {

            foreach (\get_defined_constants(false) as $name => $value) {

                if ($value === $errno && \strpos($name, 'SOCKET_E') === 0) {

                    return ' (' . \substr($name, 7) . ')';

                }