Register here to save your progress
How to setup a PHP file
To tell to the server that our scripts from within file represents PHP code, we need to include it between <?php and ?>.
<?php // ... here we put the PHP code ?>
A PHP file must have the extension .php at the ending of it's name, having a full name like "contact_us.php" or "homepage.php" .
What are the delimiters for the PHP scripts?
When writing PHP code we may want to add some explanation lines or just add some short descriptions. This is a thing that it's quite encouraged, this way you or somebody else will understand better and easier the purpose of your code.
The server will not use the comments, it will treat them as they don't exist among the code.
To add a single line of comment use // at the beginning of the line.
<?php //This is a single line of comment
If you need to add longer comments you can use the delimeters /*, that marks the start, and */ that marks the end of the comment.
<?php /* This is the first line here is the second line and here is the last line */
How do you add comments in PHP?