Contents

PHP tutorials

Introduction

Syntax

Variables

Data Types

Operators

echo

If/Else

Loops

chmod()

mail()

date()

phpinfo()

 

 

Syntax

PHP's syntax is similar to most other programming languages as C and Java. A PHP script always starts with <?php and ends with ?> That script can be placed anywhere in the document.

<html>
<head>
<title>Simple PHP Page</title>
</head>
<body>

<?php
  echo "Hello World";    //This is a comment
  /*
  This is another comment
  */
?>

</body>
</html>

 

Each code line in PHP must end with a semicolon.

Here we used the PHP function echo to write Hello World.

In PHP, we use // to make a single line comment or /* and */ to write multiple line comments.