how is echo implemented in php
how is echo implemented in php
am 14.08.2007 22:58:40 von Water Cooler v2
When used with the command line interface, echo writes to the stdout,
whereas in a Web environment, it writes to the response stream. How is
it implemented inside PHP?
Does it write to a stream?
Re: how is echo implemented in php
am 14.08.2007 23:14:02 von luiheidsgoeroe
On Tue, 14 Aug 2007 22:58:40 +0200, Water Cooler v2
wrote:
> When used with the command line interface, echo writes to the stdout,
> whereas in a Web environment, it writes to the response stream. How is
> it implemented inside PHP?
I really couldn't tell you, to see how it is emplemented exactly you'll
have to take a look at the source I suppose. For more information how it
works on the command line:
> Does it write to a stream?
Well, everything in PHP can be reached 'as a stream', how the inner
workings are is offcourse a different story. This tidbit of information
leads me to believe it is just written to the output stream, where this is
actually directed is not really decided there:
:
"php://output allows you to write to the output buffer mechanism in the
same way as print() and echo()."
--
Rik Wasmus
Re: how is echo implemented in php
am 14.08.2007 23:17:52 von Water Cooler v2
On Aug 15, 2:14 am, Rik wrote:
> On Tue, 14 Aug 2007 22:58:40 +0200, Water Cooler v2
> wrote:
>
> > When used with the command line interface, echo writes to the stdout,
> > whereas in a Web environment, it writes to the response stream. How is
> > it implemented inside PHP?
>
> I really couldn't tell you, to see how it is emplemented exactly you'll
> have to take a look at the source I suppose. For more information how it
> works on the command line:
>
>
> > Does it write to a stream?
>
> Well, everything in PHP can be reached 'as a stream', how the inner
> workings are is offcourse a different story. This tidbit of information
> leads me to believe it is just written to the output stream, where this is
> actually directed is not really decided there:
>
> :
> "php://output allows you to write to the output buffer mechanism in the
> same way as print() and echo()."
> --
> Rik Wasmus
I downloaded the source on my Windows XP Pro machine. Can you please
tell me in which folder I can find the definition of the function?
Re: how is echo implemented in php
am 14.08.2007 23:19:47 von Ivan Marsh
On Tue, 14 Aug 2007 13:58:40 -0700, Water Cooler v2 wrote:
> When used with the command line interface, echo writes to the stdout,
> whereas in a Web environment, it writes to the response stream. How is
> it implemented inside PHP?
>
> Does it write to a stream?
I'm assuming it's written to stdout no matter where it's run... as with
CGI applications, the browser interface IS stdout and the webserver
controls where the output goes.
Re: how is echo implemented in php
am 14.08.2007 23:23:52 von luiheidsgoeroe
On Tue, 14 Aug 2007 23:17:52 +0200, Water Cooler v2
wrote:
> On Aug 15, 2:14 am, Rik wrote:
>> On Tue, 14 Aug 2007 22:58:40 +0200, Water Cooler v2
>> wrote:
>>
>> > When used with the command line interface, echo writes to the stdout,
>> > whereas in a Web environment, it writes to the response stream. How is
>> > it implemented inside PHP?
>>
>> I really couldn't tell you, to see how it is emplemented exactly you'll
>> have to take a look at the source I suppose.
>
> I downloaded the source on my Windows XP Pro machine. Can you please
> tell me in which folder I can find the definition of the function?
It is not a function, it's a language construct. And sorry, can't tell you
where to find it, you'll have to search for it yourself, or possibly ask
one of the developers.
--
Rik Wasmus
Re: how is echo implemented in php
am 15.08.2007 10:13:27 von Toby A Inkster
Ivan Marsh wrote:
> I'm assuming it's written to stdout no matter where it's run... as with
> CGI applications, the browser interface IS stdout and the webserver
> controls where the output goes.
That would be my assumption too, which the added note that on Apache,
mod_php hooks into the web server itself, so probably has something to do
with informing Apache that stdout should be sent to the HTTP client.
--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.12-12mdksmp, up 55 days, 11:51.]
Fake Steve is Dead; Long Live Fake Bob!
http://tobyinkster.co.uk/blog/2007/08/13/fake-bob/
Re: how is echo implemented in php
am 15.08.2007 10:55:55 von gosha bine
On 14.08.2007 22:58 Water Cooler v2 wrote:
> When used with the command line interface, echo writes to the stdout,
> whereas in a Web environment, it writes to the response stream. How is
> it implemented inside PHP?
>
> Does it write to a stream?
>
If you interested in php internals, I'd recommend browsing their LXR
site. For 'echo', start here
http://lxr.php.net/source/ZendEngine2/zend_vm_def.h#883
and follow the links.
--
gosha bine
makrell ~ http://www.tagarga.com/blok/makrell
php done right ;) http://code.google.com/p/pihipi