2

I have a php page that calls and runs a method called pagestart() in a class called construct. Later in that same page I call a different method in a different class. If that different method errors for any reason I would like to have it call the error() function in the construct class.

My question is is there a way to call the error() method without doing:

include_once("class/construct.class.php");
$construct = new construct;
$construct->error($msg);

And just tell the function to look in the class included by the main php file?

Thanks.

1 Answer 1

4

You could call set_error_handler at the start of that function and restore_error_handler at the end of it.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.