Logo

Programming-Idioms

History of Idiom 59 > diff from v25 to v26

Edit summary for version 26 by :
[PHP] No x init needed. Comments.

Version 25

2016-03-02, 03:27:27

Version 26

2016-03-02, 08:56:08

Idiom #59 Write to standard error stream

Print the message "x is negative" to standard error (stderr), with integer x value substitution (e.g. "-2 is negative").

Idiom #59 Write to standard error stream

Print the message "x is negative" to standard error (stderr), with integer x value substitution (e.g. "-2 is negative").

Code
$x = -2;
$STDERR = fopen('php://stderr', 'w+');
fwrite($STDERR, "{$x} is negative\n");
Code
$STDERR = fopen('php://stderr', 'w+');
fwrite($STDERR, "{$x} is negative\n");
Comments bubble
You can also use error_log()
Comments bubble
You can also use error_log().
Stderr is unusual in a PHP web server.
Origin
http://dren.ch/php-print-to-stderr/
Origin
http://dren.ch/php-print-to-stderr/