← Back to topics
Topic

standard input in php

p
parkins
how to read from standard input in php? In task, sum of two numbers, how to read numbers M and N from standard input?
g
g0loob

<?php
$f = fopen("php://stdin","r");
$a = fscanf($f,"%d %d");
echo $a[0] + $a[1];
?>