PHP Syntax
Basic PHP Syntax
PHP is server-side scripting language so PHP scripts are executed on the server. A PHP script can be placed anywhere in the document.
A PHP code starts with < ?php and ends with the ? >. PHP statements end with a semicolon (;).
Example
<?php // PHP code to be executed echo "Hello, world!"; ?> |
Comments in PHP
A comment is a simply text that is ignored by the PHP engine. The purpose of comments is to make the code more understandable. It heps developers for edit the code in future. There are many types of php comments.
Example
<!DOCTYPE html> <html> <body> <?php // This is a single-line comment # This is an another single-line comment /* This is a multiple-lines comment block that supports multiple lines */ echo "Example of php comments"; ?> </body> </html> |