Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8712829
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:11:29+00:00 2026-06-13T05:11:29+00:00

While developing my website, I have error reporting enabled. But every time an error

  • 0

While developing my website, I have error reporting enabled. But every time an error is generated, it gets generated on the top of the page, before the opening tag. This breaks the document sometimes and changes many aspects of the website such as performance and the way in elements are displayed.

Is there any way to collect all of the errors and display them all at the bottom of the page?

Thanks heaps!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T05:11:30+00:00Added an answer on June 13, 2026 at 5:11 am

    You could create your own error handler and collect all the errors into the file, for instance. Or into the array and then show all the errors at the bottom of the page, as you requested.

    Here’s how it should go:

    <?php
    // At the top of your PHP code
    
    class MyError
    {
        protected static $collected = array();
    
        public static function getCollectedErrors()
        {
          return self::$collected;
        }
    
        protected static function addError($key, $error)
        {
          if (!isset(self::$collected[$key]))
            self::$collected[$key] = array();
    
          self::$collected[$key][] = $error;
        }
    
        // CATCHABLE ERRORS
        public static function captureNormal( $number, $message, $file, $line )
        {
            // Insert all in one table
            $error = array( 'type' => $number, 'message' => $message, 'file' => $file, 'line' => $line );
            // Display content $error variable
            self::addError('error', $message . " at " . $file . ':' . $line);
        }
    
        public static function captureException( $exception )
        {
            // Display content $exception variable
            self::addError('exception', $exception);
        }
    
        // UNCATCHABLE ERRORS
        public static function captureShutdown( )
        {
            $error = error_get_last( );
            if( $error ) {
                ## IF YOU WANT TO CLEAR ALL BUFFER, UNCOMMENT NEXT LINE:
                # ob_end_clean( );
    
                // Display content $error variable
                self::addError('shutdown', $error);
            } else { self::addError('shutdown', '<none>'); return true; }
        }
    }
    
    set_error_handler( array( 'MyError', 'captureNormal' ) );
    set_exception_handler( array( 'MyError', 'captureException' ) );
    register_shutdown_function( array( 'MyError', 'captureShutdown' ) );
    ?>
    

    And then, you could get the access to all the errors, by category using this:

    Error::getCollectedErrors();
    

    UPD: To display the errors at the bottom of the page, add this code to the place you want to output the errors:

    <?php
        $errors = MyError::getCollectedErrors();
    
        foreach ($errors as $category => $items) {
            echo "<strong>" . $category . ":</strong><br />";
    
            foreach ($items as $error) {
                echo $error . "<br />";
            }
        }
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just found something very weird while developing a website. While trying to
Hi while developing a lightbox for a website it seems I made an error
While developing a website, firebug threw me a javascript error linking to the execution
While I'm developing responsive website I have used this uni-code ( » ) to
I have been reading around about best practices when doing developing a website. But
i m developing a dynamic website but i have a problem with a query.
While developing my ASP.NET MVC, I have started to see the need for a
While developing my WordPress application i have a requirement where i need to show
I have began developing a website which has facebook integration and it seems to
I'm currently developing a website which will have heavy load, and a certain amount

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.