Using PHP: Part 1: Console Input and Output

Learning PHP

Using PHP

PHP: Hypertext Preprocessor (PHP) is a server-side scripting language frequently used as part of web development and as a command-line tool for common tasks.


By default, PHP will write and read data to and from the Standard Input (STDIN). This allows PHP to read and write to the command-line (console).

Console Input

Some of the common input functions include fgets(), fgetc(), and readline().

Console Output

Some of the more common output functions to output data include echo, print(), and print_r().

Play with the example on Repl.it!