gricewill Posted July 3, 2019 Share Posted July 3, 2019 In Script 8.1, some of the functions seem not to be directly defined. For example, the write function is: function write($data) { if (@!fwrite($this->_fp, $data . "\n")) {throw new Exception(...); } It seems like it should say positively to execute "fwrite($this->_fp, $data)", but instead it just says if it doesn't do this, then throw an exception. It seems like the conditional would always be true since the script never told the computer to do it. What am I missing? Link to comment Share on other sites More sharing options...
Larry Posted July 3, 2019 Share Posted July 3, 2019 Ah, sorry for the confusion. By putting fwrite() as the condition, it'll always be executed when the write() method is called. The condition then reacts based upon the result of the fwrite() call. Put another way: the fwrite() call is not being conditionally called; it's always called. Link to comment Share on other sites More sharing options...
gricewill Posted July 3, 2019 Author Share Posted July 3, 2019 Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts