2018-10-12 15:37:13 -04:00
---
2018-10-17 21:18:27 +03:00
title: PHP Syntax and Comments
2018-10-12 15:37:13 -04:00
---
2018-10-17 21:18:27 +03:00
### PHP Syntax
2018-10-12 15:37:13 -04:00
2018-10-17 21:18:27 +03:00
The structure of a PHP syntax somewhat looks like:
2018-10-12 15:37:13 -04:00
```shell
< ?php
// Your PHP code goes here.
?>
```
2018-10-17 21:18:27 +03:00
2018-10-12 15:37:13 -04:00
This PHP script can be placed anywhere in the document.
2018-10-17 21:18:27 +03:00
A PHP file generally has HTML tags, and some scripting code.
2018-10-12 15:37:13 -04:00
The default file extension for PHP files is `.php` .
### How to make comments in PHP?
A comment in PHP code is a line that is not read/executed as part of the program. Its only purpose is to be read by someone who is looking at the code.
2018-10-17 21:18:27 +03:00
In PHP, comments can be made by two ways either single-lined or multi-lined.
The code snippet given below explains multiple ways of commenting:
2018-10-12 15:37:13 -04:00
```shell
< ?
// This is a single-line comment
# This is also a single-line comment
/*
2018-10-17 21:18:27 +03:00
This is a multiple-line comment block
2018-10-12 15:37:13 -04:00
that spans over multiple
lines
*/
?>
```
### More information
For more resources you can visit: https://www.w3schools.com/php/php_syntax.asp