PHP - Error and Exception Handling
Which of the following is the correct syntax to throw an exception with the message "Error occurred" in PHP?
throw new Exception("message") to throw an exception with a message.throw new Exception("Error occurred"); matches the correct syntax exactly. The other options either omit the new keyword, have the wrong order of keywords, or lack quotes around the message.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions