How to read console/user input in PHP?

php, terminal

Solution

I think you are looking for the readline function

$number = readline("Enter a number: ");
echo 'You picked the number: '.$number;

http://www.php.net/manual/en/function.readline.php

Problem

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?

Original source