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

  • Home
  • SEARCH
  • 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 6970747
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:44:58+00:00 2026-05-27T16:44:58+00:00

Sometimes my scripts produce an error, mostly a Warning . I have sometimes an

  • 0

Sometimes my scripts produce an error, mostly a Warning.
I have sometimes an idea why this happens, but I have also no clue sometimes why it happens.

Now my question: Is it possible that if a warning gets showed, I can see for what was in the variable?

“Warning: Invalid argument supplied for foreach() in ….”;

I get this message but no clue, what was in the variable.
The problem is, it’s a script running few hours, with different data, so it’s hard to reproduce it. Because, I don’t know what was in the variable.

I need this for all kind of Warnings / Errors / Notice / Fatal Error etc.

Thanks for the help.

P.S.

  • 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-05-27T16:44:59+00:00Added an answer on May 27, 2026 at 4:44 pm

    you have a full chapter in php dedicated to errors: http://www.php.net/manual/en/book.errorfunc.php

    From the php manual: http://www.php.net/manual/en/function.set-error-handler.php

    function myErrorHandler($errno, $errstr, $errfile, $errline)
    {
        if (!(error_reporting() & $errno)) {
            // This error code is not included in error_reporting
            return;
        }
    
        switch ($errno) {
        case E_USER_ERROR:
            echo "<b>My ERROR</b> [$errno] $errstr<br />\n";
            echo "  Fatal error on line $errline in file $errfile";
            echo ", PHP " . PHP_VERSION . " (" . PHP_OS . ")<br />\n";
            echo "Aborting...<br />\n";
            exit(1);
            break;
    
        case E_USER_WARNING:
            echo "<b>My WARNING</b> [$errno] $errstr<br />\n";
            break;
    
        case E_USER_NOTICE:
            echo "<b>My NOTICE</b> [$errno] $errstr<br />\n";
            break;
    
        default:
            echo "Unknown error type: [$errno] $errstr<br />\n";
            break;
        }
    
        /* Don't execute PHP internal error handler */
        return true;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have several scripts which will run every 10 minutes . But sometimes the
We sometimes write dataport scripts that rename tables or columns and have other complex
I love the IDLE. However, sometimes I have 100-200 line scripts and I want
I have a Perl script, that's supposed to match this string: Sometimes, he says
I have a group of PowerShell scripts that sometimes get run together, sometimes one
I have a strange problem with php scripts - mysql_affected_rows() sometimes returns 0 for
This is a idea for a security. Our employees shall have access to some
In an NSIS installer script I have: RMDir $INSTDIR Now, if the user sets
Sometimes I write scripts without any filename extension. For example: #!/usr/bin/env node console.log('hello world!');
I want a website where-in it will store all my (quick)scripts online. Sometimes I

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.