Is there a good reason to manually check the return value of that
function as it is shown in the manual?
Nope, there isn't.
Mysqli can check for errors automatically, you just have to ask it to do so.
Configure mysqli to throw an exception every time it gets an error, and you won't have to check any mysqli function for the error manually anymore!
Hence, add the following line before mysqli_connect()
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
and that's all!
Note that you have to deal with possible errors the right way. You can read about it in my article, PHP error reporting
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…