I'm trying to solve a problem where you write a script and then get:
- multiple test cases with 5 integer user inputs
- one test case with one single 0
I want to check the number of user inputs and then determine which code is executed.
Something like this:
if(fscanf(STDIN, '%d%d%d%d%d', $a, $b, $c, $d, $e) == 5) {
echo "Five inputs";
} elseif(fscanf(STDIN, '%d', $a) == 1) {
echo "Only one input";
}
So if you get for example the input 1 2 3 4 5 it should echo "Five inputs" but if you only get 0 it should echo "Only one input".