Saturday, 19 October 2013

Comments in php

Comments in php
This is a tutorial for comments inside php.In php or any program you use you would be knowing how important is commenting in codes to understand to find proper codes easily there are two types of commenting methods one is single line comment and second is multiple line comments. comments help us and other programmer what program does and where its going.We can write note for copy-write reasons. If we pass our codes to other coder or for modification by other programmer comments are useful to explain them what we want to do actually
Example for single line comments (Screenshot1):-
Comments in php
Comments (Screenshot1)
1
2
3
4
5
<?php
 
//Uses echo language <span id="IL_AD4" class="IL_AD">construct</span> to output the text "Hello World." to the Browser
//echo 'Hello world.";
?>
output(Screenshot2) :-
Comments in php
Comments (Screenshot2)
In this codes we had comments codes and out comment both in “//” so will not display in browser it will only show to the coded file which is useful only for programmer to see program flow. we can also comments codes which had error but later useful we can comment them.
Example for single line comments (Screenshot3):-
Comments in php
Comments (Screenshot3)
1
2
3
4
5
<?php
 
//Uses echo language construct to output the text "Hello World." to the Browser
echo 'Hello world.";
?>
Output (Screenshot4):-
Comments in php
Comments (Screenshot4)
Example for multiline Comments (Screenshot5):-
Comments in php
Comments (Screenshot5)
1
2
3
4
5
6
7
8
9
<?php
/*
Author:Mohammed
Date:7/3/2013
*/
 
//Uses echo language construct to output the text "Hello World." to the Browser
echo 'Hello world.";
?>
Output (Screenshot6):-
Comments in php
Comments (Screenshot5)
Mutliline comments is used for note in our codes.

Read More Extra Tutorials

No comments:

Post a Comment