What is PHP

What is PHP?

Acronyms Technology

PHP (“Hypertext Preprocessor as defined by abbreviationfinder“) was a set of applications written using the Perl language, which Rasmus named Personal Home Page Tools. Personal Home Page Tools is a scripting language designed primarily for use in developing and programming web applications . It can also be used to produce stand-alone programs that are not related to the web only.

PHP is an open source language developed by a team of volunteers under the PHP license. It supports object-oriented programming and its structural structure is very similar to the C language. In addition, it works on multiple operating systems such as Linux and Windows.

History

PHP/FI

PHP first appeared in 1995 by Rasmus Lerdorf. It was called PHP/FI at the time. In fact, it was not a programming language at that time, but rather a group of applications written using the Perl language. Rasmus named these applications Personal Home Page Tools, because he later needed to More Useful Applications Rasmus wrote a larger application using the C language that was able to connect to databases and also allowed users to develop simple dynamic website applications. Rasmus chose to make the source code for PHP/FI publicly available so that anyone could use it and By improving it and participating in solving its errors and problems.

At that time, PHP/FI contained some of the functions available in current versions of the language. Its variables were similar to Perl’s variables, and its syntax was similar to Perl’s, despite its simplicity and limitations.

In 1997, version 2.0 of PHP/FI was launched. The number of its users at that time reached 50,000 domains, and there was a group of people involved in the development. The official version of 2.0 was launched in November of the same year after several beta versions.

PHP 3

In 1997, PHP/FI was rewritten by Zev Souraski and Andy Gettmans after they found that PHP/FI 2.0 was not powerful enough to write an e-commerce application that they were working on as a graduation project for their university. There was a collaboration between them and the language’s founder, Rasmus . Lerdorf expects PHP 3.0 to be the official version after PHP/FI.

One of the most important features that distinguishes PHP 3 from its predecessor is that it has become expandable and provides many libraries and functions with this version. This scalability has led many developers to develop new libraries and add them to the language, and it is said that this is the main reason for the success it has achieved. This version, and another feature that was added in this version is object-oriented programming.

In this version, the name of the language was changed and put under a new name, which was PHP (without FI), which had an abbreviation for a new meaning different from the previous version, and the meaning was “PHP: Hypertext Preprocessor.”

PHP 3.0 was released in June 1998 after 9 months of testing.

PHP 4

In 1998, shortly after the official launch of PHP 3.0, Zev Souraski and Andy Getmans began rewriting the foundation of the PHP language. The goal was to improve performance for complex and large programs and improve the language’s extensibility.

The new engine that appeared after the book was redone was called the Zend engine, and the name “Zend” was taken from the first letters of its developers’ names. They succeeded in achieving their goals through this engine, and it was announced in 1999.

PHP 4.0 is based on this engine, and this version of PHP was announced in May 2000. In addition to improving performance, this version also contained a new set of features, such as support for a larger number of web servers, sessions, and new secure methods for processing income. user and others.

Development and support for PHP 4 was announced on July 13, 2007. [17]

<?php $page_title = “My website”;?><html> <head> <title><?php echo $page_title;?> </title> </head> <body> Hello </body></html>

Usage

Website schema in PHP

The PHP language often runs on a web server. It can also be used as a command-line interface or used to develop programs with a graphical interface that run on the user’s computer. PHP can be used under most web servers and runs on most operating systems, and its development team It provides its complete source code so that users can build and develop it to suit their needs.

PHP basically takes the file containing the PHP commands (.php files) as input and outputs displayable data.

In the fourth version of PHP, it converts files written using PHP into byte code for processing via the Zend engine. In the fifth version, the PHP language advanced with very high technologies, and the latest version of the fifth version was 5.5.9.

Use on the server side

In fact, PHP was designed to be used on the server side and to build interactive web applications, and the Lamb build has become very popular in the web industry as a secure, inexpensive, and reliable web software method. PHP is denoted by the letter P in LAMP as a programming language, alongside Linux (L) as an operating system, Apache (A) as a web server and MySQL (M) as a database management system. Other builds have also appeared, such as MAMP replacing Linux with Windows (W), and MAMP replacing Linux with Mac OS (M).

PHP can be used with a large number of database management systems, and since it is available on a number of operating systems, its flexibility has enabled PHP to spread.

Use as a command line

PHP also provides a command-line interface, so it can be used to develop a range of programs that facilitate administrative tasks for system administrators.

Use on the client side

PHP provides graphical user interface libraries such as GTK+ (via PHP-GTK ) and Qt (via Qt ) which make non-Web software development possible.

Grammatical structure

Example to print a Hello World program :

<?php echo ‘Hello World’;?>

And also in this way

<?php echo ‘Wikipedia’ ?>

PHP only executes what is between the <?php and ?> tags, and anything outside these two tags is printed directly and is not treated as PHP code. This feature enables PHP code to be inserted into HTML code, for example:

<html> <head> <title><?php$page_title = ‘Wikipedia’;echo $page_title;?> </title> </head> <body> Hello</body> </html>

Variables are preceded by a dollar sign – $ – and it is not necessary to define the type of the variable, unlike the names of functions and classes. Variables are case sensitive, and in order to put a value for the variable, double quotes – ” – or single quotes – ‘ – or without any quote mark are used, so that The value in this case is in one of the following forms:

  • One of the types of numbers is both floating numbers and integers.
  • Of the quality of constants.
  • Call one of the subroutines
  • Calling a subroutinevia an object.

PHP has three types of comments, /* */ which is used for multi-line comments, // and # which is used for single-line comments.

Data types

PHP stores numbers with a range that depends on the processor they are running on. This range is typically 32-bit integers. Integer variables can be decimal, octal, or hexadecimal. Real numbers are also stored with a range that depends on the processor.

PHP also contains a Boolean type, which is called “booleen”. As in Perl, numbers greater or less than zero can be considered true, while zero can be considered false.

The null data type represents variables that do not contain a value, and the only value in this data type is NULL.

Arrays support text and numeric indexes, and arrays can contain elements of any data type supported by PHP.

Objects

In PHP 3, the basics of object-oriented programming were added, and it was rewritten in PHP 5 in order to improve performance and add more features. In previous versions of PHP, objects were treated as primitive types. The weakness of this method was that the object was completely copied when it was assigned as a variable or when passed to functions, and this problem was solved in PHP 5.

In PHP 5, private and protected types were declared for both functions and variables, and the standard way of defining constructors and destructors was declared.

class foo extend How to define the class foo that inherits the bar class, and define the general function mystaticfunc, which can be called as follows: foo::mystaticfunc();

Resources

Libraries

PHP includes a large number of free and free libraries. Most of these libraries give PHP its nature as a language for writing web applications, as it contains libraries for accessing FTP and a group of libraries for accessing databases such as MySQL, SQLite, and others, many Functions are similar to C language functions.

Additions

PHP allows developers to write add-ons to it using the C language to add new functions. There is more than one type of add-ons, some of which are translated with PHP code and others run at runtime (during program execution). Add-ons have been used to support a group of functions such as control functions. Add-ons for Unix systems, to add Windows API, Corel, and some unparalleled features like IRC and many more, there is a site called PECL that collects add-ons.

Encryption programs, performance improvement, acceleration

The function of encryption programs is to encrypt PHP files into an incomprehensible format with the aim of hiding the code for several reasons. Some see it as security reasons, and some see it as useful for commercial programs. There are two types of encryption programs, the first type hides the source code, the second type translates the code. To another code, then a specific add-on is installed that in turn translates the resulting code and makes it understandable in terms of the engine that will execute it. The most famous encryption programs are those provided by Zend and ionCube Technologies Ltd.

As for performance improvement programs, they improve the quality of the compiled code by reducing its size and making some modifications that reduce execution time.

Finally, as for accelerator programs, their function is to improve performance through the cache process, as they store the translated code in memory so that you can use it later instead of having to translate and convert the code every time the file is requested. Commercial programs are available such as Zend Platform and free others such as xcache, eAccelerator, and APC.

Revisions

Debuggers help analyze the code in order to notice errors, examples of which are Advanced PHP Debugger and Xdebug.

Template engines

It is a set of functions used to separate HTML code from PHP code, and one of the most famous template engines is Smarty.

PEAR

It is a project that aims to write reusable libraries using PHP. The libraries of this project are always written using object-oriented programming.

Technical support

PHP has a manual that contains documentation for all the functions it provides, in addition to the answers to many questions that can be found after doing a simple search on the Internet, and PHP users help each other through chat programs, forums, mailing groups, and many other places. Available to help novice PHP programmers.

Criticisms

She criticizes PHP for a number of points, including:

  • PHP uses the Magic Quotes feature,which attempts to ignore the ‘ and ‘ tags in texts used in databases in order to prevent SQL injection vulnerabilities. This leads to some confusion as the data that this process is processing is not differentiated. The advantage over others that it does not address.
  • PHP does not have real support for Unicode.

Launch date of major releases

Release Launch date The most important modifications
PHP 1.0 June 8, 1995 Its official name was “Personal Home Page Tools (PHP Tools)”. This version is the first to use the PHP name.
PHP Version 2 (PHP/FI) April 16, 1996 Its programmer considered it the “fastest and simplest tool” for creating interactive websites.
PHP 3.0 June 6, 1998 Development went from one person to several people, Zev Souraski and Andy Getmans rewriting the basis for this version.
PHP 4.0 May 22, 2000 A professional implementation system called Zend Engine was added.
PHP 4.1 December 10, 2001 Arrays appear ($_GET, $_SESSION etc.).
PHP 4.2 April 22, 2002 register_globals is closed by default.
PHP 4.3 December 27, 2002 The command line interface appears.
PHP 4.4 July 11, 2005
PHP 5.0 July 13, 2004 The appearance of the second version of the Zend engine
PHP 5.1 November 24, 2005
PHP 5.2 November 2, 2006 Add-ons filter turned on by default.
PHP 5.3 June 30, 2009 Add Namespace and return Undefined errors for variables that do not hold values.
PHP 5.4 March 1, 2012 Support Trait, support short sentence feature. Removed items: register_globals, safe_mode, allow_call_time_pass_reference, Session_register(), Session_unregister() and Session_is_registered(). Built-in web server. Many improvements to existing features, performance and lower memory requirements.

Future development

PHP version 6 has been in development since July 2007, and aims to resolve some of the drawbacks of PHP 5.

  • True Unicodesupport.
  • Remove magic_quotesproperty.
  • Remove ereg functions and replace them with preg. <These are offices from which several functions descend, not just one function>
  • Remove variables HTTP_*_VARS.
  • Remove register_globals property.
  • Remove the safe_mode property.

What is PHP