Code: Select all
<!DOCTYPE html>
<html>
<body>
<h1>php Examples</h1>
<?php
echo "Welcome to Hosting Chatter.";
# Above prints out "Welcome to Hosting Chatter" and this line is a comment.
// This is another type of comment.
/* This is a multi-line comment.
This is the 2nd line */
?>
</body>
</html>
Code: Select all
<!DOCTYPE html>
<html>
<body>
<h1>More php Examples</h1>
<?php
$a_random_choice_for_transport = "bus";
echo "Jane often rides a {$a_random_choice_for_transport}."
// The above statement is php's version of string interpolation as you don't have to worry about spaces
// etc. The statement prints out (no parenthesis) "Jane often rides a bus."
?>
</body>
</html>
