Breaking News

PHP-MySQLi Series Part 3 || basic syntax of php, Comment in php, echo/pr...



Php is a server side scripting language. In php we use echo or print function to display data or text in a browser.

Syntax:
<?php

Code goes here.

?>

Comment in php:
Comments in php are similar to comments that are used in HTML. The php comment syntax always begin with a special character (// or /*   */).The text that appears between the start of the comment and end will be ignored.

We can use comment in php in two ways;
1) Single Line comment:
     Single line comment start with // or # sing.
Syntax:
<?php
//This is single line comment. (This line will not display.)
echo "Welcome to Letshelp2all.blogspot.com.";
?>


2) Multiple-line comment:
   We can use multiple line comment to write comments of more than one line.
It start with /* and end with */ symbol.

Syntax:
<?php
/* This is multiple line comment.
We can write more than one line comment.
*/

$x = 10;
$y = 10;
$z = $x+$y;
echo $z;
?>

Echo/Print Function:
Echo and print functions are used to get output in a browser.

Syntax:
<?php
$a = 5;
$b = 10;
$c = $a + $b;
echo $c;
?>
Output will be:
15

No comments