How do I get my own error message on php?

I have a php script. There is a variable which gets bigger and bigger until I get an error. This error happens when I do something like $variable = $variable.$othervariable. I would like to know the values of $variable and $othervariable exactly in the moment I get the error. Is there a way to do this?

2 Responses to “How do I get my own error message on php?”

  • Ttony21:

    You need to set an error handler like this:
    <?php
    function returnvalues($variable, $variable.othervariable)
    {
    echo "$variable $variable.othervariable";
    }

    set_error_handler("returnvalue s");
    ?>

  • Colinc:

    The easiest way is to use :
    echo "Var1 ",$variable," Var2 ",$othervariable,"<br />";
    This will show the variable building down the page.

Leave a Reply