The PHP programming language: from the origins to the present


What is PHP language and why is it so popular

He was annually predicted to disappear due to lack of demand. But years later, he is still at the top. Meet the most common language – PHP

Author in the field of IT, digital, economics and finance. Leads a non-profit project for young writers “LitTsekh”.

PHP: Hypertext Preprocessor (originally Personal Home Page Tools) is one of the leading languages ​​in modern web development. His father is the Danish programmer Rasmus Lerdorf, who in 1994 created a set of Perl scripts – the very “personal home page” that formed the basis of PHP.

Over time, developers from all over the world joined the work on it. PHP is one of the oldest languages ​​in the open source project. Now it is supported and developed by a group of enthusiasts led by Zend Technologies. It is led by Zeev Surasky and Andy Gutmans: in 1997 they created the third version of PHP and actively develop the language to this day.

First property: interpretability

The main characteristic of PHP is interpretability. Unlike Java, which is compiled and then run, PHP is created when it is called. A person opens a site, a request is sent to the server, and at this time the code is compiled. Each script is compiled in real time and then executed.

Here is a code example:

<?php

/**

 * Class for saving files other than images

 */

class Application {

 protected $_image = null; // file to work with

 /**

  * method saves the file to disk

  *

  * [id153965260|@param] string $path – new file path

  * [id153965260|@param] srting $imagePath – old path

  * [id16226053|@return] boolean

  */

 public function saveFile($imagePath, $path){

  $result = file_get_contents($imagePath, $path);

  $nameDir = explode(‘/’,$path);

  $newNameDir= ‘files/’.$nameDir[1].’/’.$nameDir[2].’/’.$nameDir[3];

  mkdir($newNameDir, 0777, true);

  $resultWrite = file_put_contents($path, $result);

  return $resultWrite;

 }

}

This property makes PHP a very flexible language. For example, a Java programmer enters the name of a class once – now it is unchanged. PHP is compiled at runtime and you can substitute any class name from the variable.

However, for the sake of flexibility, the developer sacrifices the speed of the site. In the case of Java, a program is created and then run. In the case of PHP, you have to take the user’s time to compile the code.

Second property: dynamic typing

Programming languages ​​are:

 1) with static typing;

 2) with dynamic typing.

In the first case, the type of the variable is determined rigidly and in advance. If it is a number, the programmer will write the type int. If string is string. In the second case, the variable can be simultaneously a number, a string, an array, an object – anything. One variable can be assigned a number, then an array, an object – and the programming language will allow it. PHP belongs to the second group.

But there’s a problem

The problem with dynamic typing is that it leads to a decrease in speed and consumption of a large amount of RAM. But dynamic typing is flexible and convenient, which is why PHP is so popular.

The PHP development team is currently working on making it less memory consuming while still retaining the flexibility of a statically untyped language.

Version overview: between the first and seventh

Versions one through three were “raw”: few features, although they were enough to create simple sites. Since version 5.4 PHP has become a mature technology. Before that, there were too many nuances, and it was not easy to work with them.

Releases 5.5 and 5.6 are serious, time-tested things. They have shown themselves well and are sufficiently protected from injections and hacking opportunities.

The sixth version was skipped: it was supposed to support Unicode at the kernel level, but the release did not take place. “PHP6 was ambitious but sucked. That’s why we got into PHP 7, skipping version 6 in the process,” Vilson Duka, one of the developers, commented on his blog.

Learning PHP from Scratch: Tips and Tricks for a Beginner

Where to start for a newbie

Learn by doing

Our experts unanimously declare: if you want to learn PHP, start writing your website. It can be anything: an online store, a notebook, a landing page. We advise you to first start the project in “pure” PHP, without the use of frameworks. It will take much more time, but you will get an idea of ​​how everything works from the inside. Then start learning frameworks.

Transfer your project to one of them – we recommend Laravel and Yii. If you know one, then it will be easier to learn related ones: the meaning is the same everywhere, the difference is in the nuances. You will encounter a huge number of pitfalls, but this is what will be a valuable experience.

Get an internship

You have carefully studied the documentation, read all the articles about PHP, started writing your site, but what’s next?

Keep moving in the chosen direction: get an internship in a company from your city. Another option is to immediately apply for the position of junior developer. Companies have different requirements for the same vacancy, since the range of tasks to be solved is different. It is likely that you will be lucky. In any case, completing test tasks is also an important experience for growth.

However, at the initial stage, do not get a remote job: live communication with professionals who can become your mentors is a very important point for active growth.

Learn programming in general

Since PHP is still a full-fledged language, no matter what the haters say, the rules of object-oriented programming code architecture apply to it. SOLID-principles work for PHP as well, so you just need to know OOP if you really want to understand it and program well, and not mindlessly copy the syntax and other people’s solutions.

We recommend reading Matt Zandstra’s PHP. Objects, Patterns, and Programming Techniques. It will deepen the understanding of the structure of the language. In general, when studying, try to avoid outdated information.

Last tip

But almost the first in importance. Understand: Why should you learn PHP as your first language? This is a tool that you need to choose for specific tasks. The approach to learning can also be different depending on your goals.

  • Become a freelancer and make websites on CMS for customers.
  • Get a position at a well-known company.
  • Create your own project, develop and earn with it.

Leave a Reply

Your email address will not be published.