This language bar is your friend. Select your favorite languages!
Edit summary for version 25 :
New PHP implementation by user [siuv]

Version 24

Version 25

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");
Comments bubble
You can also use error_log()
Origin
http://dren.ch/php-print-to-stderr/