Or is actually a short-circuit in PHP or
Often see this statement:
$file = fopen ($filename, R) or die ("Sorry, unable to open: $filename");
Or is understood here, because the data type is not differentiated in PHP, so the $file can be either int or bool, so the statement does not get an error.
But the process may be some friends are not very clear.
In most languages, in a statement such as BOOL or bool, a value is no longer judged if the previous value is true.
This is also the case, so if the fopen function executes correctly, it returns an int value greater than 0 (which is actually "true"), and the subsequent statement will not be executed. If the fopen function fails, it will return false, then it will determine if the subsequent expression is true.
The result is that after the die () is executed, no matter what is returned, the program has stopped executing, and the specified error message is displayed, and the purpose of debugging is achieved.