When run from the CLI, the constants STDIN, STDOUT, and STDERR are predefined. These constants are file handles, and can be considered equivalent to the results of running the following commands:
STDIN = fopen("php://stdin", "r");
STDOUT = fopen("php://stdout", "...