Is there any native PHP function which throws an b

2020-03-01 16:59发布

While answering PHP rename() doesn't throws exception on error I was wondering if there are any native PHP functions which throw a built-in Exception, beside the SPL stuff?

3条回答
迷人小祖宗
2楼-- · 2020-03-01 17:35

Not really. If you read the note on that page you linked:

Note:

Internal PHP functions mainly use Error reporting, only modern Object oriented extensions use exceptions. However, errors can be simply translated to exceptions with ErrorException.

查看更多
干净又极端
4楼-- · 2020-03-01 17:40

PHP 5 has an exception model similar to that of other programming languages.

ErrorException

查看更多
登录 后发表回答