I have a kind of 'basics' question about php. In the example code for fgets
, it has this snippet as an example of reading through a file's contents:
while (($buffer = fgets($handle, 4096)) !== false) {
echo $buffer;
}
How is it that the statement ($buffer = fgets($handle, 4096))
can have a value? Is it a kind of assignment+evaluation of $buffer
? I mean, how does it get its value? Is there a name for this? I notice its using strict comparison, so do all assignments evaluate to a boolean true or false?
If I wanted to write a function that could be treated this way, do I have to do anything special, other than return false on certain conditions?