Input | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

Input

aren't we supposed to have something like cin>> in PHP?

23rd Apr 2018, 7:28 PM
Ms. N
Ms. N - avatar
4 Answers
+ 3
you cannot retrieve input directly in php since php is processed on the web even before you get to see it.Unlike other languages here which demand inputs first,then compile later on sololearns server,php has to run once rather you use html forms,and get the info from those forms with $_get[] or $_post[]
23rd Apr 2018, 7:48 PM
᠌᠌Brains[Abidemi]
᠌᠌Brains[Abidemi] - avatar
+ 3
Damyan Petkov that has to do with reading files not input,but since files can also be used as input no problem,but if youlld have to receive input from a user,files are useless,youll need a form,lets not confuse the two😇
23rd Apr 2018, 7:59 PM
᠌᠌Brains[Abidemi]
᠌᠌Brains[Abidemi] - avatar
+ 2
you can read php input like that file_get_contents('php://input') I used this to read json data push to the php
23rd Apr 2018, 7:54 PM
Damyan Petkov
Damyan Petkov - avatar