Skip to content

Instantly share code, notes, and snippets.

@marek-saji
Created May 8, 2019 21:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marek-saji/d73b570bf4efe66f9636ac05a76172e1 to your computer and use it in GitHub Desktop.
Save marek-saji/d73b570bf4efe66f9636ac05a76172e1 to your computer and use it in GitHub Desktop.
<?php
ini_set('display_errors', true);
for ($i = 1; $i <= 4; $i += 1)
{
echo 'out', $i, PHP_EOL;
if ($stderr = fopen('php://stderr', 'a'))
{
fprintf($stderr, "err{$i}\n");
}
}
?>
#!/bin/sh
# prints all err messages
php foo.php
# prints only first two err messages
php < foo.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment