I use gets
to get an user input in Ruby.
# in 0015.rb
input_num = gets.to_i
p "Your input number is #{input_num}."
And I use it in a terminal.
➜ rubytest: ruby 0015.rb
24
"Your input number is 24."
Can I do like this in PHP with terminal?
I think you are looking for the readline function
$number = readline("Enter a number: ");
echo 'You picked the number: '.$number;