PHP Language: Basics Guide For Beginners

PHP Language: Basics Guide For Beginners

PHP is a server-side scripting language used to create static websites or dynamic websites or web apps. PHP stands for Hypertext Preprocessor, which is originally designed for web development.

Only a server that has PHP installed can interpret PHP scripts. Only a web browser is required for client pcs accessing PHP scripts.

History of PHP

Development of PHP started in 1994 when Rasmus Lerdorf wrote several Common Gateway Interface (CGI) programs in C language which he used to keep his personal homepage. He expanded them to work with web forms and connect with databases and called this application "Personal Home Page" or PHP.

PHP can be used to create easy, vibrant internet apps. To speed up bug reporting and improve code, on June 8, 1995Lerdorf initially announced the release of PHP as "Personal Home Page Tools" (PHP Tools) version 1.0 on the Usenet discussion group comp.infosystems.www.authoring.cgi.

This release already had the fundamental features that PHP has today. Which included variables similar to Perl, form handling, and the ability to embed HTML. The syntax resembled of Perl's but was easier, more limited, and less consistent.

Early PHP was not intended to be a new programming language and grew organically, with Lerdorf pointing out 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.

After months of work and betting, a development team started to develop the language.

The fact that PHP was not originally intended but instead developed organically resulted in improper naming of functions and irregular ordering of their parameters. In some cases, the function names were chosen to match the lower-level libraries.

PHP was "wrapping," while in some very early versions of PHP the length of the function names was used internally as a hash function. So names were chosen to improve the distribution of hash values.

What does PHP mean?

PHP means "Personal Home Page", but it now stands for the PHPHypertext PreprocessorPHP code can be integrated into HTML code or used in connection with multiple web template technologies, web content management system and internet frameworks.

PHP mascot

The elePHPant is the mascot of PHP.

The PHP project mascot is the elePHPant, a blue elephant with the PHP logo on its side, designed by Vincent Pontier in 1998.

Php mascot

"When regarded in a sideways angle, the (PHP) letters created an elephant's shape."

The elePHPant is sometimes colored differently when in plastic toy shape.

Many variations of PHP mascots were made over the years. The only elePHPant based on Vincent Pontier that original design is considered official by the Community.

Syntax of PHP

 echo 'Hello World!';


Hello World!

PHP file may also contain tags such as HTML and client-side scripts like JavaScript.

Syntax of PHP

We must always include the PHP code in PHP tags for the server to identify the PHP code from the HTML code.
  • HTML is an added advantage when learning the language of PHP. You can even learn PHP without understanding HTML, but it is suggested that you at least understand the basics of HTML.
  • You will need JavaScript and XML for more advanced topics such as interactive apps and web services.
  • Database management systems DBMS for applications are powered by a database.

PHP Hello World

The program shown below is a basic PHP application that produces the words "Hello World!", When viewed on a web browser.

 <title>Hello World Program</title>
 <?php echo "Hello World!";?>


Hello World!

However, since there is no requirement for PHP code to be embedded in HTML, the simplest version of "Hello World!" can be written like this, with the closing tag omitted as preferred in files containing pure PHP code.

PHP File Extensions

The file extension and tags to identify your PHP files and scripts with the server, we need to save the file with the extension ".php" Older extensions of PHP files include:

  • phtml
  • php3
  • php4
  • php5
  • phps

PHP was designed to work with HTML and can be embedded in HTML code as such.

Why use PHP?

You have several numbers of programming languages out there; you may wonder why we would like to use PHP as our heart for web programming. Below are a few of the strong reasons.

  • PHP is always free and open source.
  • Large community document for this language.
  • Short learning keywords and functions compared to other languages like ASPJSP, etc.
  • By default, most internet hosting servers support PHP unlike other languages such as ASP that require IIS. This makes PHP a value-effective option.
  • PHP is regularly updated to maintain up with the recent technology developments.
  • PHP supports working hand in hand with MySQL; this does not mean that you can not use PHP with other database management systems.
  • PHP is a cross-platform language; that means you can install your application on different operating systems such as WindowsLinuxMac OS, etc.

Run PHP online

Run PHP files on PC

If you run PHP files on PC, you need to install any one software from below.

After installing any one software from here, only you need to open any browser to run PHP files.

If you create or edit PHP files on pc, you need to install this software from below.

Development and Community of PHP

PHP contains in its source distribution lots of free and open-source libraries or uses them to create PHP binary builds.

PHP is mainly an Internet-aware system with built-in modules to access File Transfer Protocol (FTP) servers and multiple database servers, including PostgreSQLMySQLMicrosoft SQL ServerLDAP servers, and others.

In normal PHP builds there are multiple features familiar to C programmers, such as those in the stdio family.

To add features to the PHP language, PHP enables developers to write extensions in C. You can compile PHP extensions statically into PHP or dynamically load them at runtime.

Installation and configuration of PHP

There are two main methods to add assistance to a web server for PHP–either as a native webserver module or as an executable CGI.

PHP has a direct module interface called Server Application Programming Interface (SAPI) that is endorsed by many internet servers including Apache HTTP ServerMicrosoft IIS, and iPlanet.

Some other web servers like OmniHTTPd support the Internet Server Application Programming Interface (ISAPI), which is the webserver module interface for Microsoft.

If PHP does not have module support for a web server, it can always be used as a Common Gateway Interface (CGI) or as a FastCGI processor.

Uses of PHP

There are over 50 million websites and applications created using PHP scripting language in terms of market share on the internet.

The following diagram shows some of the famous PHP sites.

I think you should understand the basic information of PHP language from this article.

If you are interested to learn PHP programming with details, you can buy these books from here.

Share your thoughts about the PHP language in the comment box.

Read Also:

C Language (Basics)

C++ Language (Basics)

Java Language (Basics)

Python Language (Basics)

Javascript Language (Basics)

Ruby Language (Basics)

Swift Language (Basics)

HTML Language (Basics)

CSS Language (Basics)

12/Post a Comment/Comments

  1. Thanks for reading this article, keep updating with us in the technology.

  2. One more advantage of uses written in PHP programming language is that they are fast and simple to utilize whenever written in a suitable way and are truly secure. CakePHP Application Development

  3. PHP's principle center is development for the web, so it has a fast development time and can comprehend situations a lot snappier than a portion of the other website composition dialects.Why use Laravel

  4. I admire this article for the well-researched content and excellent wording. I got so involved in this material that I couldn’t stop reading. I am impressed with your work and skill. Thank you so much. Ecommerce Web Development in UAE

  5. Now a days there are lots of developer which create or develop website. as we also provide Real Estate Website Design Edmonton at affordable prices. for more info visit our website.

  6. One definition recommended by the Foundation for a Free Information Infrastructure is that a software patent is a "patent on any presentation of a PC acknowledged by methods for a PC program". download itools 4 full crack

  7. Very nice post.This blog is actually valuable. . This concept is a good way to enhance knowledge. For more details, visit us: mvn is not recognized as an internal or external command

  8. Very impressive and interesting blog found to be well written in a simple manner that everyone will understand and gain the enough knowledge from your blog being much informative is an added advantage for the users who are going through it. Once again nice blog keep it up.
    web development sydney


Post a Comment

Previous Post Next Post