Concept
How does PHP perform basic input and output?
ComputerScienceOne / Basic I/O
"Recall the main purpose of PHP is as a scripting language to serve dynamic webpages. However, it does support input and output from the standard input/output. There are several ways to print output to the standard output. The keywords print and echo (which are aliases of each other) allow you to print any variable or string. PHP also has a printf() function to allow formatted output. Some examples:\n\n1 $a = 10;\n\n2 $b = 3.14;\n\n3\n\n4 print $a;\n\n5 print \"The value of a is $a\n\n\";\n\n6\n\n7 echo $a;\n\n8 echo \"The value of a is $a\n\n\";\n\n9\n\n10 printf(\"The value of a is %d, and b is %f\n\n\", $a, $b);\n\nThere are also several ways to perform standard input, but the easiest is to use fgets"
Related Ideas
- How does PHP support basic input and output?ComputerScienceOne · String Concatenation
- How does PHP handle file input and output?ComputerScienceOne · Opening Files
- What environment is needed to run a basic PHP program?ComputerScienceOne · Getting Started: Hello World
- How do you open and validate files in PHP?ComputerScienceOne · Opening Files
- How does scanf() read integer, character, and floating-point input in C?ComputerScienceOne · Basic I/O