Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #10317

Re: Reading a file on same server

Message-ID <3235081.K99DxYmB1T@PointedEars.de> (permalink)
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Organization PointedEars Software (PES)
Date 2013-07-31 15:13 +0200
Subject Re: Reading a file on same server
Newsgroups comp.lang.php
References <94992e21-fd7e-47b5-868f-6735808e50a4@googlegroups.com>

Show all headers | View raw


Bruce Lee wrote:
^^^^^^^^^
Doubtful.  Bruce Lee would have known the answer, having instructed Chuck 
Norris who, as we all know, can write 100 LOCs of PHP with one finger in 
less than one minute.

> Method 1:
> read file using relative path
> 
> Eg: get_file_contents("public/upload/test.txt");
> 
> 
> Method 2:
> read file using URL (note that the server which is making the request and
> the server where the file is being read is same)
> 
> Eg: get_file_contents("http://mydomain.com/public/upload/test.txt");
> 
> 
> Can someone explain me which is faster and why?

Yes.  But if you thought harder about what needs to happen in each case to 
get the file contents (i.e., do your own homework), you could have explained 
it yourself.  That said, you could have just measured it:

<http://php.net/microtime>


PointedEars
-- 
When all you know is jQuery, every problem looks $(olvable).

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Reading a file on same server Bruce Lee <phpzendguru@gmail.com> - 2013-07-31 04:13 -0700
  Re: Reading a file on same server The Natural Philosopher <tnp@invalid.invalid> - 2013-07-31 12:40 +0100
  Re: Reading a file on same server Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-07-31 15:13 +0200
  Re: Reading a file on same server "J.O. Aho" <user@example.net> - 2013-07-31 18:09 +0200
    Re: Reading a file on same server Luuk <luuk@invalid.lan> - 2013-08-01 21:28 +0200

csiph-web