All posts by admin

PHP Syntax

Any where we can use PHP script inside of the document.

The PHP script start  with <?php and ends with ?>

<?php
// PHP code goes here
?>

The default file extension is .php  ( Eg. test.php )

Example :

To get a fell of PHP code, first we will start  with simple PHP script. Since “Hello, World!” is an essential example, first we will create a friendly little “Hello, World!” script.

<html>
<head>
<title>Hello World</title>
<body>
    <?php echo "Hello, World!";?>
</body>
</html>

It will produce the following output

Hello, World!

Note: PHP statements are terminated by semicolon ( ; )

Comments in PHP:

A  comment in PHP code is a line, that is not execute or read by program. Below we mentioned the different types of comments in PHP.

<?php
     // Single line comment
     # single line comment
     /*
        Multiple line comment
     */
?>

Case-insensitive in PHP:

In PHP, all user defined function, classes and keywords ( Eg: print, echo, foreach, while, etc., ) are case-insensitive.

<?php
         print("test");
         PrInt("test");
         PRINT("test");
?>

Output:
test
test
test

PHP Introduction

Basic Knowledge

Before you are going to start PHP you should have a basic knowledge of the following :

  • HTML
  • CSS
  • Javascript

What is PHP ?

  • PHP :: Hypertext Preprocessor
  • PHP is server side scripting language
  • PHP is open source scripting language
  • PHP is free of cost and its free to download and use.

Why PHP ?

  • PHP runs almost on all of the platform like Windows, Linux, Unix, Mac OS X, etc.,
  • PHP is compatible with most of the web servers like Apache, IIS, mongodb, etc.,
  • PHP supports wide range of Databases like MySql,Sql,PgSql,etc.,
  • We can download PHP from www.php.net

Characteristics of PHP

  • Simplicity
  • Security
  • Efficiency
  • Familiarity
  • Flexibility

Execution

  • The PHP script is executed on the server, and the plain HTML result is sent back to the browser.

PHP Home

  • PHP –> Hypertext Preprocessor
  • PHP is a Server side scripting language
  • PHP is widely used and free of cost.
  • Before proceeding with this tutorial you should have the basic knowledge of computer programming , internet , Database and Mysql.
  • For testing you can use online editor compileonline.com