diff --git a/features/commandline.xml b/features/commandline.xml index e565e2a5f4..4cb7659da3 100644 --- a/features/commandline.xml +++ b/features/commandline.xml @@ -1,5 +1,5 @@ - + Using PHP from the command line @@ -110,6 +110,65 @@ + + + The ease the operating in the shell environment, the following constants + are defined: + + CLI specific Constants + + + + Constant + Description + + + + + STDIN + + An already opened stream to stdin. This saves + opening it with + +$stdin = fopen('php://stdin', 'r'); + + + + + STDOUT + + An already opened stream to stdout. This saves + opening it with + +$stdout = fopen('php://stdout', 'w'); + + + + + STDERR + + An already opened stream to stdout. This saves + opening it with + +$stderr = fopen('php://stderr', 'w'); + + + + + +
+
+ + Given the above, you don't need to open e.g. a stream for + stderr yourself but simply use the constant instead of + the stream resource: + +php -r 'fwrite(STDERR, "stderr\n");' + + You do not need to explicitely close these streams, this is automatically + done by PHP. + +
The CLI SAPI does