Home  >  Article  >  Backend Development  >  What problem does PHP's try catch solve?

What problem does PHP's try catch solve?

WBOY
WBOYOriginal
2016-10-22 00:00:201288browse

I know that PHP has exception handling. I checked it on Baidu and they all told you how to write the syntax. Just follow the instructions above and assume you know how to use it. But I haven’t found an article that tells you why you should use try catch and what problem it appears to solve. I've seen it said that it can reduce "if...else and other wild ways" in the code, but I didn't go into details.
If you know anything, continue to look for the answer, and will come back often to pay attention to the answer to this question.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn