PHP (php 7.3.5) sample

34

<?php
 
$hi = fopen('php://stdin', "r");
$ho = fopen('php://stdout', "w");
 
while (true) {
	fscanf($hi, "%d", $n);
	if ($n == 42) break;
	fwrite($ho, sprintf("%d\n", $n));
}
 
fclose($ho);
fclose($hi);

Comments

Submit
0 Comments