prasadmsvs
prasadmsvs

Reputation: 1739

Reading a command line input in PHP

I want to read command line input in PHP. I used fscanf(STDIN, "%d", $numbers_arr[$i]); But this takes input when enter key is pressed. How can i read input when the space key is pressed.

The input format will be in two lines like below

5 2

1 2 3 4 5

first line consists of two inputs and second line consists of no.of elements entered as first number in first line.

please let me know how to do this

Upvotes: 1

Views: 662

Answers (1)

Okonomiyaki3000
Okonomiyaki3000

Reputation: 3696

This is not how PHP works on the command line. You'll need to find a different way to structure your input.

Upvotes: 0

Related Questions