About Lesson
Syntax & Comments
PHP Syntax:
- PHP code is written inside:
<?php
// your code
?>
- PHP statements end with a semicolon (;).
Example:
PHP
<?php
echo "This is PHP!"; // statement ends with ;
?>
PHP Comments:
1. Single-line comment:
// This is a single-line comment
# This is also a single-line comment
2. Multi-line comment:
/*
This is a
multi-line comment
*/
Example:
PHP
<?php
// Printing a message
echo "Hello World!";
/* Multiple line comment
explaining the below line */
echo "Learning PHP is fun!";
?>