Created
July 21, 2014 23:02
-
-
Save sun/d02c242514c8f34bccdb to your computer and use it in GitHub Desktop.
PHP CLI vs. STDIN / STDOUT / STDERR — https://bugs.php.net/bug.php?id=43283
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ echo "<?php var_dump(STDOUT);" > y.stdout | |
$ php y.stdout | |
resource(2) of type (stream) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ php -r "var_dump(STDOUT);" | |
resource(2) of type (stream) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ echo "<?php var_dump(STDOUT);" | php | |
PHP Notice: Use of undefined constant STDOUT - assumed 'STDOUT' in - on line 1 | |
PHP Stack trace: | |
PHP 1. {main}() -:0 | |
Notice: Use of undefined constant STDOUT - assumed 'STDOUT' in - on line 1 | |
Call Stack: | |
0.0000 125824 1. {main}() -:0 | |
string(6) "STDOUT" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ echo "<?php var_dump(STDOUT);" > y.stdout | |
$ php < y.stdout | |
PHP Notice: Use of undefined constant STDOUT - assumed 'STDOUT' in - on line 1 | |
PHP Stack trace: | |
PHP 1. {main}() -:0 | |
Notice: Use of undefined constant STDOUT - assumed 'STDOUT' in - on line 1 | |
Call Stack: | |
0.0000 125824 1. {main}() -:0 | |
string(6) "STDOUT" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ php | |
<?php | |
var_dump(STDOUT); | |
^Z | |
PHP Notice: Use of undefined constant STDOUT - assumed 'STDOUT' in - on line 2 | |
PHP Stack trace: | |
PHP 1. {main}() -:0 | |
Notice: Use of undefined constant STDOUT - assumed 'STDOUT' in - on line 2 | |
Call Stack: | |
18.4301 125824 1. {main}() -:0 | |
string(6) "STDOUT" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment