Reputation: 23
I read on another topic that
file('file:///path/to/file.txt');
file('/path/to/file.txt');
are equivalent. So, what's the point to use file:// stream wrapper?
Are there some cases where there are some differences?
Upvotes: 0
Views: 137
Reputation: 1631
No, well maybe yes...
They both use the file:/ stream wrapper, yes.
However, if you register a different wrapper for the file:// protocol, than PHP's, which while fun to implement, it's not a good idea, as you will loose almost all optimizations.
If you did, both require 'somefile.txt' and require 'file://somefile.txt' would be equivalent, as in they would both be using the same stream wrapper, but that stream wrapper may not be PHP's default one.
Upvotes: 1