Download this Blogger Template by Clicking Here!

Ad 468 X 60

Saturday, 9 March 2013

Widgets

How to add comments in Php code?

Comments in Php Code :


PHP comment
PHP comment

Why We Need Comments :

Add Php Comments
Add Comments

  • Whenever we write a piece of code in any Programming language, then sometimes it happens that we understand the code simply and easily at that time. But when we see that code after sometime then it becomes very difficult to even understand our own code.
  • Similarly when we give our code to some other person then it also gets very much difficult for the other person to understand that code.
  • An other scenario is that when we write a code and test it , it is running fine. And then make some changes to the code and test again, then it fails. Now we try to get back to the previous code. And since we have changed the code so it becomes hard again to correct our code. We sometimes even lost our concentration due to the disturbance created. So to solve all these problems there is one solution. The solution to add and make comments in your code.

What Are Comments :


Comments are basically text present along with the code and engines of programming languages like php ignore the comments and don't consider as the part of the code.



Comments make the code clear to reader and the programmer. If you want to make changes in the code then do not delete the code . Just comment that code and write your new code. In case you are lost in the program then you can have a backup of your previous code in form of comments.


Why php comments
Why Use Comments In Code


How To Add Comments In PHP ?


Single Line Comments :
To comment a single line in the code Just add two forward slashes // or hash # to the line . It will be clear to you when you see the example below


//this is a comment
or
# this is a comment

If you add the above lines in your code then it will not be processed by PHP engine as code. You can write whatever you want in comments.



The above method is used when you want to comment single line.


Multi Line Comments :
When we want to comment multiple lines Just add /* at the place where you want to start comment and place */ at the end of the comment. For example


/*
This
Is
A
Multi
Line
Comment
In
php
.
*/

Final Words :


Feel Free to ask questions If you have any problem. Give your views and feedback in comments. Share this post with other and help others. Subscribe for free future posts. Stay Blessed. Be Happy . Thanks. Peace 

SHARE THIS POST   

  • Facebook
  • Twitter
  • Myspace
  • Google Buzz
  • Reddit
  • Stumnleupon
  • Delicious
  • Digg
  • Technorati
Author: Mohammad
Mohammad is the founder of STC Network which offers Web Services and Online Business Solutions to clients around the globe. Read More →

0 comments: