How to Read from stdin in PHP

Reading from stdin in PHP is just like reading a file. The only difference is that the file to read is called php://stdin

<?php
echo file_get_contents('php://stdin');