PHP Tutorial
What is PHP Environment Setup of PHP PHP Syntax PHP Comments PHP Echo & print PHP Variables PHP Scope Variables PHP $ and $$ Variable PHP Constants PHP Operators PHP Data TypesPHP Conditional Statements
PHP Loop Type
PHP Arrays
PHP String PHP FunctionsPHP Form Examples
Form Intro Get & Post Form Validation / Required PHP Complete FormPHP Advanced
PHP Include / Require PHP Date & Time PHP Session PHP Cookies PHP File Handling PHP Open File PHP Read File PHP Write File PHP Append File PHP Delete File PHP File Upload PHP Sending Mail PHP Error HandlingPHP Comments
In PHP, comments are sections of code that are not executed when a program is run. It's only purpose to help the progarmmers to understand the code.
For example, when a developer is open a PHP file for the first time, so they can easily understand the php code they are looking at. And It also helps the other programmers why we wrote this code.
In PHP, two ways of commenting
- Single Line
- Multiple Lines
Single Line Comment:
It is used to explain a single line of code. we can use two symbles for comment a single line of code ( # and // ).
- # - hash tag
- // - double forward slashes
Example:
<!DOCTYPE html>
<html>
<body>
<?php
# This is my first comment
// This is another way to enter single line comment
?>
echo "Hello World"; //comment - why we are using this line
</body>
</html>
Multiple Lines Comments:
It is allow to comments multiples lines in PHP code.
Syntax: comment start with /* and end with */.
Example:
<!DOCTYPE html>
<html>
<body>
<?php
/*
This is the way of
comment multiple-lines
in PHP Code
*/
echo "Hello World";
?>
</body>
</html>
SEARCH POST HERE
Support Us
Subscribe My YouTube Channel
Join Our Telegram Channel & Support Eachother
CATEGORIES
INTERVIEW QUESTIONS
POPULAR POSTS
Elevenstech Web Tutorials
Elevenstech Web Tutorials helps you learn coding skills and enhance your skills you want.
As part of Elevenstech's Blog, Elevenstech Web Tutorials contributes to our mission of “helping people learn coding online”.
Read More
Newsletter
Subscribe to get the latest updates from Elevenstech Web Tutorials and stay up to date