Logo

Programming-Idioms

History of Idiom 120 > diff from v10 to v11

Edit summary for version 11 by :
[PHP] removing unnecessary comment

Version 10

2016-02-17, 01:47:22

Version 11

2016-02-17, 01:47:44

Idiom #120 Read integer from stdin

Read an integer value from the standard input into variable n.

Idiom #120 Read integer from stdin

Read an integer value from the standard input into variable n.

Code
fscanf(STDIN, "%d\n", $number); // reads number from STDIN
echo "Integer: {$number}\n";
Code
fscanf(STDIN, "%d\n", $number);
echo "Integer: {$number}\n";
Comments bubble
PHP can pull input from STDIN as an integer with %d
Comments bubble
PHP can pull input from STDIN as an integer with %d
Doc URL
http://php.net/manual/en/features.commandline.io-streams.php
Doc URL
http://php.net/manual/en/features.commandline.io-streams.php
Origin
http://php.net/manual/en/features.commandline.io-streams.php
Origin
http://php.net/manual/en/features.commandline.io-streams.php