Output

There are two PHP commands for output: print and echo. These are essentially the same: there is no real reason for two different commands, it’s a matter of historical anomaly. Furthermore, both commands have two forms: with or without parentheses.

Example:

<?php

print “Hello World”;

print (“Hello World”);

echo “Hello World”;

echo (“Hello World”);

?>

Screenshot of similar code in Dreamweaver code view:

PHP is commonly used to generate dynamic content. However, PHP is also used for tasks that have no user output, such as redirecting the user to a different URL.