What is php program and why you should use

What is php

PHP is a general-purpose scripting language geared towards web development. It was developed by Rasmus Lerdorf in 1994. PHP stands for Personal Home Page but some people also call it PHP: Hypertext Preprocessor. Back in the date, it was only a scripting language that could connect to the database and do some simple server-side programming but by the time, it has evolved into such a huge and beautiful language that once you get a hold on to it, you won’t be going anywhere and it will be difficult to neglect this language.

How to Run PHP?

PHP is purely server-side language and in order to run a PHP file, you have to have a server (Apache, Nginx, IIS) installed on your machine. Once your server is installed, you need to install PHP binaries as well.

if you do not have any server then you can use the command line to run PHP files but again you have to install PHP to run desired commands.

PHP Version History:

Rasmus Lerdorf wrote several CGI in 1994 to manage his personal webpage. He then extended them to work with web forms and to communicate with databases and called this PHP/FI (Form Interpreter). It was great at that time because you can build dynamic web applications now. To speed up the development process and improve the code Rasmus Lerdorf released the basic version of PHP/FI as “version 1.0” on the Usenet discussion group comp.infosystems.www.authoring.cgi on June 8, 1995. This release had the basic functionality that PHP has today.

Example of early PHP syntax:

<!--include /text/header.html-->

<!--getenv HTTP_USER_AGENT-->
<!--if substr $exec_result Mozilla-->
  Hey, you are using Netscape!<p>

<!--sql database select * from table where user='$username'-->
<!--ifless $numentries 1-->
  Sorry, that record does not exist<p>
<!--endif exit-->
  Welcome <!--$user-->!<p>
  You have <!--$index:0--> credits left in your account.<p>

<!--include /text/footer.html-->

Early PHP was not intended to be a new programming language and grew organically, with Lerdorf noting in retrospect: “I don’t know how to stop it, there was never any intent to write a programming language […] I have absolutely no idea how to write a programming language, I just kept adding the next logical step on the way.” A development team began to form and, after months of work and beta testing, officially released PHP/FI 2 in November 1997.

The fact that PHP was not designed rather it was developed organically, it had some inconsistencies with name conventions and ordering of their parameters.

PHP 3 and 4:

Zeev Suraski and Andi Gutmans rewrote the parsers in PHP in 1997 and based a new version of PHP (PHP 3), it also changed the name from Personal HomePage to PHP: Hypertext Preprocessor and then started the public testing of PHP 3 and the official launch came in June 1998.

These guys founded Zend Technologies, and on 22 May 2000, PHP 4, powered by the Zend Engine 1.0 was officially released, and by the end of August 2008, this branch reached version 4.4.9. PHP 4 is now no longer under development and nor are any security updates planned to be released.

PHP 5:

On 1 July 2004, PHP 5 was released, powered by the Zend Engine. PHP 5 was a major release and it has several features listed below:

  1. Object Oriented Programming
  2. PDO (PHP data Objects)
  3. Late Static Binding (5.3)

Developers loved it and transition from PHP 4 to PHP 5 with new coding practices

PHP 6 and Unicode:

PHP received mixed reviews due to lacking native Unicode support at the core language level. In 2005, a project headed by Andrei Zmievski was initiated to bring native Unicode support throughout PHP, by embedding the International Components for Unicode (ICU) library, and representing text strings as UTF-16 internally. Since this would cause major changes both to the internals of the language and to user code, it was planned to release this as version 6.0 of the language, along with other major features then in development.

However, a shortage of developers who understood the necessary changes, and performance problems arising from conversion to and from UTF-16, which is rarely used in a web context, led to delays in the project. As a result, a PHP 5.3 release was created in 2009, with many non-Unicode features back-ported from PHP 6, notably namespaces. In March 2010, the project in its current form was officially abandoned, and a PHP 5.4 release was prepared to contain most remaining non-Unicode features from PHP 6, such as traits and closure re-binding. Initial hopes were that a new plan would be formed for Unicode integration, but by 2014 none had been adopted.

PHP 7 release:

During 2014 and 2015, a major version of PHP was developed which is known as PHP 7. In this version, a lot of things were updated and speed was optimized. The list is below:

  • Many fatal or recoverable-level legacy PHP error mechanisms were replaced with modern object-oriented exceptions
  • The syntax for variable dereferencing was reworked to be internally more consistent and complete, allowing the use of the operators ->[](),{}, and ::, with arbitrary meaningful left-side expressions.
  • Support for legacy PHP 4-style constructor methods was deprecated.
  • The behavior of the foreach statement was changed to be more predictable.
  • Constructors for the few classes built-in to PHP which returned null upon failure were changed to throw an exception instead, for consistency.
  • Several unmaintained or deprecated server application programming interfaces (SAPIs) and extensions were removed from the PHP core, most notably the legacy mysql extension.
  • The behavior of the list() operator was changed to remove support for strings.
  • Support was removed for legacy ASP-style delimiters <% and %> and <script language="php"> ... </script>.
  • An oversight allowing a switch statement to have multiple default clauses was fixed.
  • Support for hexadecimal number support in some implicit conversions from strings to number types was removed.
  • The left-shift and right-shift operators were changed to behave more consistently across platforms.
  • Conversions between floating-point numbers and integers were changed (e.g. infinity changed to convert to zero) and implemented more consistently across platforms.

PHP 8 Release:

PHP 8 was released on November 26, 2020. PHP 8 is a major version and has breaking changes from previous versions. New features and notable changes include:

  • Just-in-time compilation
  • Addition of the match expression
  • Type changes and additions
  • Syntax changes and additions
  • Standard library changes and additions
Special Thanks to Rasmus Lerdorf