Search the Community
Showing results for tags 'binary or operator'.
Found 1 result
Chapter 11, pg. 301, contains the following text: If you are running PHP 5.1 or greater, you can add the LOCK_EX constant as the third argument to file_put_contents(): file_put_contents($file, $data, LOCK_EX); To use both the LOCK_EX and FILE_APPEND constants, separate them with the binary OR operator (|): file_put_contents($file, $data, FILE_APPEND | LOCK_EX); It doesn’t matter in which order you list the two constants. This is a really interesting solution, and I'm surprised my mind didn't registered it when I was reading that book for the first time. Could someone please explain to my why the use of | operator is possible in this situation? Is this a common use of such operator, allowing to place two arguments where only one is expected? Are there any other situations where | could be used in similar manner? Thank you in advance for your wisdom!