Last active
September 28, 2019 14:22
-
-
Save oppara/54b8d36fb235f59e24971f582a06ddc5 to your computer and use it in GitHub Desktop.
PHPで標準入力から値を取得
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$inputs = []; | |
while (true) { | |
$in = trim(fgets(STDIN)); | |
if ($in === '') { | |
main($inputs); | |
return; | |
} | |
$inputs[] = $in; | |
} | |
function main($args) | |
{ | |
var_dump($args); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$in = trim(fgets(STDIN)); | |
var_dump($in); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$a = <<<EOF | |
3 | |
3 1 2 | |
2 5 4 | |
3 6 | |
EOF; | |
main(explode("\n", $a)); | |
function main($args) | |
{ | |
var_dump($args); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment