johnmerlino1 Posted July 27, 2014 Share Posted July 27, 2014 I was looking at the manual: http://php.net/manual/en/function.fopen.php And I noticed the the binary mode 'b' is missing from the list. Any reason why? Quote Link to comment Share on other sites More sharing options...
ginerjm Posted July 27, 2014 Share Posted July 27, 2014 Same for the 't' mode. I think it is because there are so many caveats mentioned in the comments that one needs to be "more" aware of how and why to use both 'b' and 't' mode. Quote Link to comment Share on other sites More sharing options...
johnmerlino1 Posted July 27, 2014 Author Share Posted July 27, 2014 Same for the 't' mode. I think it is because there are so many caveats mentioned in the comments that one needs to be "more" aware of how and why to use both 'b' and 't' mode. But if I want to open a file for reading, can I just use r or do I need to attach b as well? $fp = fopen(“$DOCUMENT_ROOT/../orders/orders.txt”, ‘rb’); Quote Link to comment Share on other sites More sharing options...
ginerjm Posted July 27, 2014 Share Posted July 27, 2014 Read the manual and decide for yourself. Quote Link to comment Share on other sites More sharing options...
Solution kicken Posted July 27, 2014 Solution Share Posted July 27, 2014 Not sure what you mean by it being missing. The binary flag is mentioned. They just don't list r and rb as different modes because it's unnecessary. Windows offers a text-mode translation flag ('t') which will transparently translate \n to \r\n when working with the file. In contrast, you can also use 'b' to force binary mode, which will not translate your data. To use these flags, specify either 'b' or 't' as the last character of the mode parameter. Quote Link to comment Share on other sites More sharing options...
johnmerlino1 Posted July 27, 2014 Author Share Posted July 27, 2014 Read the manual and decide for yourself. Well, I linked the manual to the original question and that actually indeed was my question - why is this mode missing and since it is missing, is it not needed anymore in PHP5? Quote Link to comment Share on other sites More sharing options...
ginerjm Posted July 27, 2014 Share Posted July 27, 2014 It's been explained twice to you. If your entire question is simply curiosity about the option, then you won't get anymore here. And if your concern is about the accuracy of the manual, well then, you are going to have a field day with other functions. Signing off - too boring. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.