PHP Basics
Working with PHP Code
- PHP code is normally entered as part of an HTML page.
- PHP code must be segregated from the regular HTML code.
- While there are a couple ways to do this, marking the beginning of a PHP code section with works well in Dreamweaver.
- PHP code can be placed anywhere, but is usually in the body section of the page.
- No matter where it is placed, it is executed before any of the HTML code.
- Web pages containing PHP code should end in .php rather than in .html.
Just as in any other kind of programming or scripting it is important to document what you do. A single-line comment is marked at the beginning with /* and at the end with */.
You can comment your code using C++ type comments. The following shows the syntax for inline comments (a comment on a single line), and block comments (comments placed over several lines).
// This is an inline comment
/*
This is a block comment
placed over two or more
lines
*/