error_get_last

Supported Versions: PHP 5 >= 5.2.0, PHP 7, PHP 8
Get the last occurred error
<?php error_get_last(): ?array
<?php         if (false === $this->master) {



            $error = \error_get_last();

            \preg_match('/\[(\d+)\]: (.*)/', $error['message'], $m);

            $errno = isset($m[1]) ? (int) $m[1] : 0;

            $errstr = isset($m[2]) ? $m[2] : $error['message'];
<?php         if (false === $newSocket) {



            $error = \error_get_last();

            $errstr = \preg_replace('#.*: #', '', $error['message']);

            $errno = self::errno($errstr);
<?php                         @\fwrite($stream, \PHP_EOL);

                        $error = \error_get_last();




                        \preg_match('/errno=(\d+) (.+)/', $error['message'], $m);
<?php             if ($errno === 0 && $errstr === '') {

                $error = \error_get_last();

                if (\preg_match('/\(([^\)]+)\)|\[(\d+)\]: (.*)/', $error['message'], $match)) {

                    $errstr = isset($match[3]) ? $match['3'] : $match[1];

                    $errno = isset($match[2]) ? (int)$match[2] : 0;