Syntax of PHP


Basic PHP Syntax

A PHP content can be put anyplace in the report.
A PHP script starts with <?php and ends with ?>:

Syntax - 

<?php
// PHP code goes here
?>

The default file extension for "PHP files" is ".php"

Example -

<!DOCTYPE html>
<html>
<body>
<h1>My first PHP page</h1>

<?php
echo "Hello World!";
?>


</body>
</html>


Comments

<?php
// This is a single-line comment
# This is also a single-line comment
/*
This is a multiple-lines comment block
that spans over multiple
lines
*/


// You can also use comments to leave out parts of a code line$x = 5 /* + 15 */ + 5;
echo $x;
?>



Share on Google Plus

About It E Research

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment