title: How to process stdin to stdout in php?
body: <p>I'm trying to write a simple php script to take in data from <code>stdin</code>, process it, then write it to <code>stdout</code>. I know that PHP is probably not the best language for this kind of thing, but there is existing functionality that I need. </p>
  
  <p>I've tried </p>
  
  <pre><code>&lt;?php
  $file = file_get_contents("php://stdin", "r");
  echo $file;
  ?&gt;
  </code></pre>
  
  <p>but it doesn't work. I'm invoking it like this: <code>echo -e "\ndata\n" | php script.php | cat</code>.  and get no error messages. The script I'm trying to build will actually be part of a larger pipeline.</p>
  
  <p>Any clues as to why this is not working?</p>
  
  <p>PS: I'm not very experienced with PHP.</p>