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             } else {

                $message = 'File at "%s" could not be parsed as PHP, it may be binary or corrupted';

            }

            $error = error_get_last();

            if (isset($error['message'])) {

                $message .= PHP_EOL . 'The following message may be helpful:' . PHP_EOL . $error['message'];

            }
<?php             $shutdownRegistered = true;



            register_shutdown_function(function () {

                $lastError = error_get_last();



                if ($lastError && $lastError['message'] &&

                   (strpos($lastError['message'], 'Allowed memory') !== false /*Zend PHP out of memory error*/ ||
<?php             }



            if (!$unlinked) {

                $error = error_get_last();

                $message = 'Could not delete '.$path.': ' . @$error['message'];

                if (Platform::isWindows()) {

                    $message .= "\nThis can be due to an antivirus or the Windows Search Indexer locking the file while they are analyzed";
<?php             }



            if (!$deleted) {

                $error = error_get_last();

                $message = 'Could not delete '.$path.': ' . @$error['message'];

                if (Platform::isWindows()) {

                    $message .= "\nThis can be due to an antivirus or the Windows Search Indexer locking the file while they are analyzed";