How to handle error situations more elegantly in PHP?

Suppose now there is a function getUserInfo() that queries for user information and the parameter is userId. If the userId passed in does not meet the formatting requirements, or if the corresponding user information cannot be found based on this userId, the function has 2 ways to handle the situation return false or null to […]