PHP was created sometime in 1994 by Rasmus Lerdorf. During mid 1997, PHP development entered the hands of other contributors. Two of them, Zeev Suraski and Andi Gutmans, rewrote the parser from scratch to create PHP version 3 (PHP3).
The PHP programming language is a server-side HTML embedded scripting language.
Let‘s depict the sentence. The PHP language runs on the server-side. This means that the execution (read starting) of the scripts is done on the server where the web-site is hosted. HTML embedded means that you can use PHP statements (read a piece of PHP code) from within an HTML code. PHP files are returned to the browser as plain HTML.
The last piece of the sentence – scripting language – is a little harder to explain, but we will give it a go. A scripting language is a form of programming language that is usually interpreted rather than compiled. In programming languages such C or C++ you compile the program (permanently) into an executable file, before you can execute the program. A program that is written in a scripting language, is interpreted one command at a time by a command interpreter (Command interpreter is in most cases an executable written in another language (for instance C/C++) than the scripting language.) Some other examples of scripting languages are Perl, Python, Java and Ruby.
Facts About PHP
Because PHP is an HTML embedded language you should have a basic understanding of HTML/XHTML and (a little) JavaScript.
- PHP stands for PHP: Hypertext Preprocessor.
- PHP is a server-side scripting language.
- PHP is free and is an open source software product.
- The PHP scripts are executed on the server.
- PHP supports many databases (MySQL, Sybase, Oracle and many others.)
- PHP runs on different platforms (UNIX, Linux and Windows.)
- PHP is compatible with almost all web-servers used today (Apache, IIS, etc.)
- A PHP file can contain plain text, HTML tags and scripts
- The PHP files can have one of the following extensions: php, php3 or phtml.
Where Does PHP Stands Today?
Today, PHP is estimated to be installed on millions of web servers worldwide, fueling an estimated 244 million websites.
Some analysts claim that over 90% of the Internet is enabled by PHP scripts. Yet, ironically, some analysts and professional language critics still view PHP’s success as a quirk. What’s the truth? How important is PHP to the Internet or to our organizations?
As of April 2013, PHP use on web servers now outstrips the use of every other server-side scripting language on the Internet. It’s implemented more than ASP.NET, Java, ColdFusion, Perl, Ruby, and Python combined. As the language-to-know, it is—in a single word—”imperative.”
Market Share of Server-Side Languages | |||||
2010 1 Jan |
2011 1 Jan |
2012 1 Jan |
2013 1 Jan |
2013 10 Apr |
|
PHP | 72.5% | 75.3% | 77.3% | 78.7% | 79.0% |
ASP.NET | 24.4% | 23.4% | 21.7% | 20.2% | 20.0% |
Java | 4.0% | 3.8% | 4.0% | 4.1% | 4.1% |
ColdFusion | 1.3% | 1.2% | 1.1% | 1.1% | |
Perl | 1.1% | 1.0% | 0.8% | 0.7% | |
Ruby | 0.5% | 0.5% | 0.6% | 0.5% | 0.5% |
Python | 0.3% | 0.3% | 0.2% | 0.2% | 0.2% |
Yet, despite its popularity—or because of it—PHP has had some unique growing pains. So understanding how PHP grew can help us understand how the latest PHP tools are bringing added power and functionality to our systems.
PHP – The Road Ahead
Obviously, a lot has changed since PHP first came on the scene in 1995. And PHP has grown to meet the challenges of those changes. Yet, for some developers who continue to seek the Holy Grail of language perfection, the question of a future for PHP seems ludicrous. For these nay-sayers, PHP still suffers from a lack of rigorous structure, a growing fragmentation of server services, and a tarnished reputation for the unusual delay of the PHP Version 6 stack. “Sure, PHP is popular,” these developers say, “but it’s not a serious language for serious developers.”
Yet the statistics don’t lie: PHP is the predominant server-side scripting language on the Internet with over 79% deployment, and it continues to gain market share, at the expense of the so-called “more serious languages” like ASP.NET, Java, Ruby, and others.
Consequently, to ignore PHP is like trying to ignore oxygen in the atmosphere: PHP has become one of the most important pieces of the Internet infrastructure, and it will be difficult for another upstart language to unseat its strategic place.
In the meantime, the PHP community continues to propel PHP to meet the demands of the Internet with constructive and creative implementations while they build upon the base established by the open-source software movement.
This is what makes the rise of PHP so interesting to industry watchers: It’s an organic, living language fueled by millions of developers who are pouring their creativity into real-world applications and uses. And, unlike so many other “serious” languages, no one “owns” PHP: It’s an open-source venture that has transformed—and will continue to transform in the decades to come—how we utilize the Internet.
So where is PHP going? The answer seems to be “Everywhere!”
Advantages of PHP
Easy to learn: PHP has a short learning curve and programmers can quickly become productive. PHP was designed to appeal to Web designers and HTML coders, and they appreciate the ability to freely mix HTML and PHP. PHP allows them to easily and gradually add dynamic page generation features to their Web sites.
Open Source: PHP is distributed under an Apache-style license that allows for both commercial and non-commercial use and development. This means that you can use it freely, without paying any licenses fees for machine, CPU, and so on. Also, there is a worldwide network of talented developers continuously improving and enhancing PHP. You can fix bugs or customize the software to your specific needs (or pay someone to do so) because the source code is available. This is not possible with commercial, off-the-shelf products.
Community: PHP has a large base of users and developers. It is easy to find programmers fluent in the language. Many online resources are dedicated to PHP (Web sites, mailing lists, and so on) that provide valuable information and support.
Database support: PHP provides extensive database support. It supports ODBC, open source databases such as MySQL and PostgreSQL, as well as commercial ones such as Microsoft SQL Server, Oracle, and Sybase.
Multiplatform support: PHP runs on a variety of platforms and Web servers. PHP runs in most flavors of UNIX and Windows as well as other OS such as Mac OS, OS X, or OS/2. PHP supports a wide variety of Web servers, ranging from the popular Apache, Microsoft IIS, and Netscape servers to less-known ones such as thttpd or AOLserver. This allows you to standardize on a common development language across a heterogeneous environment of systems and servers. You can build a solution with PHP on a specific platform/server/database combination and then migrate to a different combination gradually, replacing one component at a time. You can develop your code on a Windows workstation running IIS and deploy it on a UNIX server running Apache with little or no changes.
Extensions: PHP has a great number of available extensions and source code for everything from XML manipulation to directory access. Programmers can leverage this body of existing code to quickly put together advanced applications.
Safe mode: PHP allows execution of code in restricted environments. This option is very attractive to ISP and Application Server Providers, which can offer PHP to their clients without compromising security. These providers often want to serve multiple customers using a shared infrastructure.
Session support: Most Web applications require you to keep and manage state between requests. PHP offers native session management and an extension API so users can provide their own backend storage mechanisms.
Rapid development: PHP gets compiled to an special bytecode format before getting executed. That step is completely transparent to programmers and users. Developers can make changes to a PHP page and see the results immediately in their browsers. By comparison, Java servlet development requires compile cycles and careful configuration of things such as class loaders, and so on.
Commercial support: Several companies provide support and services around PHP, or bundle PHP as part of their server solution. Please refer to the resources at the end of this chapter to learn more about these companies. You should consider their services if you are using PHP in an enterprise environment, a mission critical Web site, or need custom features added to the language.
It’s Fun! PHP is an exciting language to program in. You can leverage existing extensions and code to quickly and easily put together great Web sites.
Disadvantages of PHP
Every language or scripting language has its own advantages or the disadvantages. Likewise, PHP has some of its own disadvantages. But these disadvantages can be overcome using advantage methods. Some people say it is a direct disadvantage, while some people say an indirect disadvantage. Disadvantage indirectly means some of the aspects and functionalities in PHP, which are not being able to complete using the direct functionality. This particular disadvantage can be overcome using an advantage method.
Let us take a simple example, say Redirection. Writing a piece of code from the client side or the server side – in some of the scripting languages there is a single task to achieve this – a single function will do so. But in the case of PHP it is done indirectly.
Error Handling: It is believed that PHP has very poor handling errors qualities. Even this disadvantage can be overcome using a feasible advantage solution.
Security: Since it is open sourced, so all people can see the source code, if there are bugs in the source code, it can be used by people to exploit the coding weaknesses.
Not suitable for large applications: Hard to maintain since it is not very modular.
Weak type: Implicit conversion may surprise unwary programmers and lead to unexpected bugs. For example, the strings “1000” and “1e3” compare equal because they are implicitly cast to floating point numbers.
Conclusion
PHP is the most extensively used server side scripting language. Over 79% of server implementations today are in PHP i.e. more than ASP.NET, Java, ColdFusion, Perl, Ruby, and Python combined. These projects range from personal home pages to high-profile financial sites.
PHP usage and the number of extensions continue to grow. The language itself continues to evolve and it is starting to find applications outside the Web-development field as a general-purpose scripting and embeddable language.
Drop Us A Note
[gravityform id=”2″ name=”Drop us a Note” title=”false” description=”false” ajax=”true”]