0

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?

1 Answers1

1

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.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
rexfordkelly
  • 1,623
  • 10
  • 15