Re: Additions to PHP_Compat

From: Date: Wed, 26 May 2004 19:00:49 +0000
Subject: Re: Additions to PHP_Compat
References: 1 2  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-29727@lists.php.net to get a copy of this message
Stefan Neufeind wrote:
<? define('ASTDIN', fopen('php://stdin', 'r')); define('ASTDOUT', fopen('php://stdout', 'w'));
var_dump($a = ASTDIN); var_dump($b = ASTDIN); var_dump($a === $b); var_dump($c = ASTDOUT); ?>
gives:
resource(1) of type (stream) resource(1) of type (stream) bool(true) resource(2) of type (stream)
So I suppose that PHP doesn't really "open" stdin, but returns the same stdin-resource again? Would be nice if somebody with a debugger could check if fopen is called twice ... in this case we could save some time using Mike's workaround he mentioned above.
No need to verify. The assignment of the constants is done during inclusion, not during call. So, even when you include it multiple times (since it asks (!is_defined())) it only get's opened once. Regards, Toby -- Tobias Schlitt GPG Key: 0xA6529579 a passion for php http://www.schlitt.info

« previous php.pear.dev (#29727) next »