Skip to content

Instantly share code, notes, and snippets.

@Khanashima
Created May 17, 2014 13:01
Show Gist options
  • Save Khanashima/42a4f589ba3733eb23db to your computer and use it in GitHub Desktop.
Save Khanashima/42a4f589ba3733eb23db to your computer and use it in GitHub Desktop.
C:\xampp\htdocs\PhpProject1>php ./single.php
1
string(1) "1"
C:\xampp\htdocs\PhpProject1>php ./multi.php
1
2
3
テスト
5
array(5) {
[0]=>
string(1) "1"
[1]=>
string(1) "2"
[2]=>
string(1) "3"
[3]=>
string(6) "テスト"
[4]=>
string(1) "5"
}
<?php
$stdins = array();
while(true)
{
$stdin = trim(fgets(STDIN));
if ($stdin === '')
{
var_dump($stdins);
return;
}
$stdins[] = $stdin;
}
?>
<?php
$stdin = trim(fgets(STDIN));
var_dump($stdin);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment