JavaScript Tutorial

What is PHP

PHP is a server-side scripting language that serves the purpose of dynamic web development.
Programmer Rasmus Lerdorf created this language in 1994 as Personal Home Page but now it stands for the recursive Acronym PHP: Hypertext Preprocessor. Latest version of PHP is 8.0.0 and it was released on 26th November, 2020.

PHP is a server-side scripting language which means that PHP code is executed on a Web Server and its result is sent back to the Web Browser in the form of HTML.

It is an interpreted language and does not require a compiler.

PHP Files contain the content in the form of HTML, CSS, Javascript and PHP and is saved with .php extension.

     +------------------------+
     |   PHP Programming       |
     +------------------------+
     | - Server-side language  |
     | - Runs on web servers   |
     | - Interpreted language  |
     | - Dynamic typing        |
     +------------------------+
                      /|\
                       |
                       |
          +--------------------------+
          |      PHP Frameworks      |
          +--------------------------+
          | - Laravel                |
          | - Symfony                |
          | - CodeIgniter            |
          | - Zend Framework         |
          +--------------------------+

The key functionalities of PHP are mentioned below:

  • PHP helps in creating dynamic web pages and applications.
  • PHP helps in performing file handling which includes creating, opening, reading, writing, deleting and closing files on the server.
  • PHP helps in form processing.
  • Helps in inserting, retrieving, updating or deleting data in a Database.
  • Cookies and sessions are created and handled in PHP.
  • Helps in encrypting and decrypting the data.
  • Helps in sending emails.

The key features of PHP are as mentioned below:

  • It is majorly popular for its simplicity and ease of learning as its syntax is similar to C
  • language.
  • It is an open source language. All PHP frameworks are freely available on the Internet to download and use.
  • It is one of the most flexible languages as it can easily integrate itself with HTML, Javascript, XML and various databases like MySQL, Oracle, Sybase etc.
  • PHP code can run on all operating systems like Windows, Linux, Unix, MacOS etc. Hence, it is a platform independent language as well.
  • It supports error reporting and handling with various pre-defined error constants. For example: E_ERROR, E_WARNING etc.
  • It is considered to be faster as compared to various other scripting languages like ASP.NET, JSP and PERL.
  • It also follows the concept of Object Oriented Programming (OOP).
  • PHP MVC (Model View Controller) frameworks also makes it easier to maintain a PHP website by organising the code in a systematic way.
  • It is a loosely typed language. Variables can be directly assigned with values without
  • declaring their data type.

There are basically three main areas where PHP is majorly used.

Server-side Scripting: This is the most commonly used area of PHP. It requires a Web Browser, a Web Server and a PHP Parser for its implementation.

Command-line Scripting: It involves the implementation of PHP code without using any browser and with the help of Parser only. It is suitable for the scripts running regularly using cron on LINUX and Task Scheduler on Windows.

Writing Desktop Applications: Advanced PHP features helps you to create client-side
graphical user interface (GUI) applications.

PREREQUISITES:

  • In order to learn PHP one must have basic knowledge of HTML, CSS and Javascript where:
  • HTML is a markup language used to create static web pages.
  • CSS is a Cascading Stylesheet used to style a webpage.
  • Javascript is a client-side scripting language used to make a user interactive
  • webpage.