Using PHP to Generate Output
MAR 18
The echo() Statement
Without displaying any output, we probably won’t be able to accomplish anything useful with our scripts, hence PHP provides several different methods of passing output to the web browser and essentially providing the user with some feedback. In particular, we’ll cover the echo() statement and the print() statement, which are the two most common ways of displaying output to the browser.
Referring back to our “Hello World” example, you can probably guess what the echo() statement does. It simply displays or echoes output directly to the browser, in this case the string “<p>Hello World!</p>” was passed to the browser and displayed to the user.
<html> <head> <title>Hello World Script</title> </head> <body> <?php //this is some php code echo '<p>Hello World!</p>'; ?> </body> </html>
