Answer the question
In order to leave comments, you need to log in
How does the OR operator work on the example of the fopen function?
Help me figure out one subtlety that haunts me)
The documentation says that the OR operator first assigns, and then the second operand is ignored:
// Константа false присваивается $f, а затем значение true игнорируется
// Действует как: (($f = false) or true)
$f = false or true;
$write = fopen($path, 'w+') or die("не удалось создать файл");
Из документации: Возвращает указатель на файл в случае успешной работы,
или FALSE в случае ошибки
($write = false) or die("не удалось создать файл");
die("не удалось создать файл")
should be ignored. Answer the question
In order to leave comments, you need to log in
If the expression, function result or assignment on the left side of the OR is boolean false, then the right side of the OR operator will be executed.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question