Introduction to PHP

Introduction to PHP

Introduction to PHP – Generally, the Full form of PHP is Hypertext Preprocessor. It is a popular open-source, server-side scripting language that is used for developing dynamic web pages. It is a set of Perl scripts that are known as the “Personal Home Page” tool. PHP is innovated by Rasmus lerdorf in 1995.

Originally, PHP 4.0 is realized in June 1998 with some object-oriented features. Facebook was developed primarily using PHP. The software which is needed to run the PHP program are: –

  • NAMP- (window os, apache server, MySQL ,dbms, php)
  • LAMP- (linux os, apache server , mysql ,dbms, php)
  • MAMP- ( Mac os, apache server , mysql ,dbms, php)
  • XAMPP- (cross-platform, apache server, maria DB, PHP, Perl)

A PHP file carries the <?php> tags and also ends with the extension “.php” i.e. : ‘filename.php’.

What is Script?

The script is a set of instructions for web pages that are executed without compilation.

Why PHP is used?

Generally, there is a huge amount of server-side scripting languages available like SSJS, ASP, JSP, etc. It is a platform-independent scripting language. Basically, PHP involves using with database or it is simple in scripting. PHP is well defined as advanced for the response times which are most important for web applications.

Features of PHP :

  • Simplicity
  • Security
  • Loosely typed language
  • Platform-independent
  • Flexibility
  • Opensource
  • Interpreted

PHP syntax:

A PHP script begins with “<?php” and ends with “?>”. The PHP script can be put anywhere in the HTML document. The extension for the PHP files is “.php“. EXAMPLE:-

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <h1>First PHP Page</h1>
    <?php
            echo "Hello World!";
    ?>
</body>
</html>

Above, we have an example of a simple PHP file, here the PHP function “echo” is used to output the text i.e “Hello Word!” on a webpage. For the ending of a PHP statement semicolon (;) is used.

Difference between Server Side Scripting and Client-Side Scripting?

Server Side Scripting:Client-Side Scripting:
Source code is not visual to the user because it is used at the backend part.
It requires server interaction.
The languages involved are PHP, ASP.net, Raily, and Python.
It has access to all the files present in the webserver.
Security is relatively secure.
Source code is visual to the user because it is used at the frontend part.
It doesn’t require server interaction.
The languages involved in the client-side are HTML, CSS, and Javascript.
It has no access to all the files present in the webserver.
Security is relatively insecure.

6 Comments

Leave a Reply

Your email address will not be published.

Sorry
Sorry
Sorry
Sorry
Sorry
Sorry
Sorry