Assignment031 - PHP Printing

Printing to the browser is accomplised using the print function:

print();

For example:print.php



<html>
<head>
<title>Print.php</title>
</head>
<body>
<?php
print("I am so happy to be a horned toad!");
print(
"<br><br>");
print(
"My favorite quote is 'In the end there can only be one HIGHLANDER!'");
print(
"<br><br>");
echo 
"printing is easy with \"PHP hypertext Preocessor\".";
?>
</body>
</html>

The same can be achieved with the echo command, but we will use print() in this class.

Also, be careful printing certain characters like quotation marks ("). Use the backslash character (\) to escape quotations, like this:

print("She said, \"I hate smelly feet.\"");

The backslash character escapes special characters that cause PHP and MySQL to generate errors.

Finally, you can combine items to print by using the period (.). The period is used to concatinate two separate string items. Concatinate is just a fancy word for put together. Here is an example:

print("My best student is ". $student);

In the above example $student is a variable that holds a name. Which brings me to variables.