register_shutdown_function

Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Register a function for execution on shutdown
<?php register_shutdown_function(callable $callback, mixed ...$args): void
<?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*/ ||

                    strpos($lastError['message'], 'exceeded memory') !== false /*HHVM out of memory errors*/)) {

                    echo "\n". 'Check https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors for more info on how to handle out of memory errors.';

                }

            });

        }



        $this->io = new NullIO();