# 一行を読み込み
fumiya.org✜ASUS:/mnt/c/pg$ seq 3 | php -r "echo fgets(STDIN) ;"
1
# それぞれの行に処理
fumiya.org✜ASUS:/mnt/c/pg/20190111030052$ seq 3 | php -r 'while($f = fgets(STDIN)){ echo "line: $f"; }'
line: 1
line: 2
line: 3
# 標準入力をひとまとめとして受け取り処理
fumiya.org✜ASUS:/mnt/c/pg/20190111030052$ seq 3 | php -r '$stdins = "" ; while($f = fgets(STDIN)){ $stdins .= $f ; } echo $stdins ; '
1
2
3
# e.g.
fumiya.org✜ASUS:/mnt/c/pg/20190111030052$ seq 3 | php -r '$stdins = "" ; while($f = fgets(STDIN)){ $stdins .= $f ; } echo $stdins . "hogehoge" ; '
1
2
3
hogehoge