Part 3: Comments and INCLUDE in PHP Programming


  1. What are the three ways you can make comments in PHP?
  2. A single line can be commented out with //. Several lines of code can be commented out with /* at the beginning and */ at the end. Finally, a one-line shell-style comment is indicated by a # at the beginning of the comment text.

  3. What is the PHP include function? Why is it useful?
  4. The INCLUDE function grabs information from another file and includes it into the current file so that you do not have to rewrite the information. It is useful for writing neater code with less repetition, and also saves time having to rewrite code.

notepad++ Example Program

The link above is the sample code created with Eli's demonstration of comments and the INCLUDE function. While the page that is loaded seems very simple, the source code includes several lines that have been commented out, and the text that appears has been loaded from an include.php file using the include PHP function..