Since code playground doesn't have PHP's 'readline' function, how can I get input from user? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Since code playground doesn't have PHP's 'readline' function, how can I get input from user?

In command line's PHP, the normal way to get input is to use the 'readline' function (e.g., "$var = readline('Type something: ');"). SoloLearn's code playground doesn't recognize that function though. There's any other way to get user input purely in PHP? If not purely, how's the simplest way to do it?

4th Feb 2018, 9:13 PM
Bruno Della Motta
Bruno Della Motta - avatar
2 Answers
+ 30
In the real world PHP script reads $_GET or $_POST superglobals to get an input when a user submits an HTML form. https://www.sololearn.com/learn/PHP/1841/
4th Feb 2018, 9:24 PM
Igor Makarsky
Igor Makarsky - avatar
+ 1
Yeah... I know... (though command line php scripts are real too :P ). But I was looking for a solution specifically for the code playground and, unlike the web option that there's a tab for html, javascript and css, php has only the code and the output...
4th Feb 2018, 10:17 PM
Bruno Della Motta
Bruno Della Motta - avatar