PHP is a scripting language mainly developed for web development. A scripting language differs from compiled language in this respect that a compiled language like C, VB, etc. first compiled and then converted into machine code which depends upon the hardware of a particular machine. That machine code commonly stored as exe file. Upon request that exe file runs to implement the program job. On the other hand a script program is a program which runs under another program. Scripts are written in ASCII text format. The parent program, usually known as script engine, read the script code line by line and executes them. Hence a script program is much slower and limited in features than a compiled program. But one advantage of a script programs are that they are portable and can be edited any time since they are written in plain text format. But once exe file created a compiled program can’t be edited since they are written in binary code.
Advantages of PHP
PHP has many advantages over other languages which make it most popular and widely used program language used for web development. These advantages are listed below.
- It is open source general purpose language; so it is freely available to all. There are many third party developers who develop extensions for PHP to improve its functionality. Examples of few such developments are PEAR package, GD library, ZLib extension, etc.
- PHP can be installed under all popular operating system including Windows, Linux and Mac.
- From version-4 and onwards PHP supports object oriented programming method.
- PHP can be mixed within HTML code. In an HTML page you can start writing script code within starting and ending tags. But the resulting page must be saved in PHP format (i.e. with.php extension) in order to run script code.
- As scripting language, – program in PHP are written in plain text and hence they are portable.
- Writing or editing program only requires a plain text editor. You can use Windows Notepad to write a program or to edit it.
- PHP is a server side scripting language, i.e. the HTML code required to build a webpage are generated at the server end and reach to the client computer. So the source code security is better than ASP or other client side language.
- PHP is very much user friendly language. In general a programmer requires smaller time to learn it than other scripting language.
- PHP is very rich language. For every functionalities which a programmer requires to build a dynamic website such as receiving form data, sending and receiving cookie, handling file upload, processing file and directory, handling array, etc. PHP comes with several inbuilt functions to implement them.
- Today all modern websites are supported by remote database. Among the external database MySql database is the most popular. PHP have a rich set of inbuilt functions to connect with MySql database server, access data from it and process them. Actually MySql supported PHP website is the most common and popular way of building website today.
- Another advantage of PHP is its large community. There are several thousands of very high quality websites which provide free code, tutorial, code help, free tools and scripts on PHP. From a simple arithmetic operation to a complex database query design, almost for every topic you can get a ready made solution from internet. In no other language have such a wide range of support available.
All though PHP is mainly developed for the purpose of web development but you can develop a small portable utility, such as file processing of a local computer with PHP.