I've seen this a lot: $fp = fopen($filepath, "w") or die();
But I can't seem to find any real documentation on this "or" syntax. It's obvious enough what it does, but can I use it anywhere? And must it be followed by die()
? Are there any caveats to using or
when you could use something like
if (file_exists($filepath))
$fp = fopen($filepath,"r");
else
myErrMessage();
I know it seems like a silly question, but I can't find any hard and fast rules for this. Thanks.
question from:
https://stackoverflow.com/questions/9535255/php-or-syntax 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…