0

I am writing a PHP class that is broken down to a few simple function. In the constructor function it calls one other function called processFile. This function calls 5 private functions and does checks. if the check fails it assigns the a message to a $var and i have a flag variable that gets set to 1 when the error has occurred. iam trying to a write something in the function processFile to check if the errorFlag is set, and it it is then not calling the other functions. How would i go about doing this?

1 Answer 1

2

You can use exception:

if (...) {
    throw new Exception(....);
}

Add try..catch block in script which create this object.

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.