// 標準入力からの入力値を変数に代入します
$single_line_input = fgets(STDIN);
// 取得した入力値を半角スペースで分解します
$array = explode(" ", $input_line);
ex)入力12 13 14 15
→[12,13,14,15]
// 単一行の入力の場合はこれだけで各入力値が配列の要素として使えます
・標準入力が複数行の場合
// 標準入力を一行ずつ配列に代入します
//trimは入力された文字列の前後の空白をなくす
while ($line = fgets(STDIN)) {
$tmp[] = trim($line);
}
// 配列の各要素をさらに分解します
foreach ($tmp as $key => $value) {
$array[] = explode(" ", $value);}