Learning PHP from scratch. Personal experience as proof: the PHP programming language is the main one on the Web

The Internet in the modern world occupies an increasingly strong position. About 15 years ago, access to the network required expensive equipment and a lot of money to pay bills. Now the Internet can be accessed for a penny by anyone who has at least mobile phone. More and more services and services are moving to electronic form. From a means of communication and information exchange, the Internet is turning into a convenient tool for doing business and making money.

Every day, millions of users visit their favorite sites, download mail, files or news, play online games, conduct company business or simply chat, blog and forums. Most of these users have never thought about how it all works, who creates new sites and services, how and with what.

This electronic textbook is intended for those who simply surf the Web is not enough. For those who want to learn how to create their own websites and be on the wave of the latest trends in programming and design.

General principles

Before you start learning a language, you need to unequivocally determine the terminology and understanding general principles the operation of the Internet. Let's start with the principles of the network and sites.

The Internet network consists of a huge number of interconnected computers, routers and other hardware needed for proper operation. Each element of the Internet (node) has a unique descriptor - an IP address. Knowing the host's IP address, you can try to connect to it, and with a little skill, you can determine who this address belongs to and in what region of the world it is located. IP addresses are usually written as four groups of numbers separated by dots, for example

192.168.100.003 or 10.10.0.123

Agree, remembering the addresses of all frequently visited pages is not an easy task. Therefore, there are special DNS (Domain Name Resolution) servers on the Internet, which store lists of mapping IP addresses and symbolic names. It is thanks to these servers that the user always gets to the desired IP address by typing only the name of the page in the browser.

After we have entered the name of the desired page in the browser line, the browser independently receives the IP address of the desired server from DNS and sends a special request to receive the page (HTTP request) to this address. A specialized program running on the server (the so-called Web server) processes this request and returns the required page to the browser.

Obviously, all page rendering actions can be unambiguously divided into two categories: those performed on the client side ( client code or front-end) and executed on the server side ( server code or back-end). Moreover, the server does not know anything about the current state of the client, and the client knows nothing about the current state of the server. When developing exchange algorithms, one must always keep this in mind and transmit the necessary data in a timely manner, describing the state or the required action.

Depending on the place of application, the means of implementing the parts also differ. On the client side, typically only HTML, JavaScript (AJAX), CSS, and Flash are used. Back-end developers are less constrained in terms of funds, because most existing languages ​​allow you to create or describe HTML pages. The most widely used now are Java, Perl, PHP, Python, Ruby, C# and VB.NET. Each of them has its own strengths and weaknesses, so the developer must make a choice based on the tasks facing him.

Why PHP?

There are a large number of languages ​​that can be used when creating websites. Some languages ​​have been around for a long time and are successfully used (or no longer used). Some languages ​​are still very young and have not yet received wide distribution. Recently, PHP has become one of the leaders in popularity, for several reasons:

  1. Simplicity. The language is very easy to understand, especially for novice programmers.
  2. Development speed. Due to its simplicity and intuitiveness, PHP allows you to create quite complex sites very quickly.
  3. Availability of libraries There are a huge number of ready-made examples and class libraries. Hundreds of libraries have been created and tested, greatly simplifying the life of a developer.
  4. Support Almost every server on the internet supports PHP
  5. Safety PHP allows you to create truly secure sites with built-in support for data encryption at rest and in transit.

However, PHP pays for its benefits with some limitations. For example, using PHP to access system functions is very inconvenient compared to Perl or Python (which is why many sysadmins love Perl so much). There are a few more limitations that we'll talk about in the relevant sections.

Knowledge of HTML allows you to get an idea of ​​how to create websites. And even gives you the opportunity to independently develop Internet resources. However, the use of this markup language is limited due to the static nature of the pages created with it. In particular, it is used in most cases for the development of business card sites. The thing is that if you need to make any changes, you need to edit each page separately, and if the resource has several tens or hundreds of them, such a process will not only be tedious, but also stretched out in time.

The use of PHP (acronym for PHP: Hypertext Preprocessor "hypertext preprocessor") allows you to optimize site administration, a scripting programming language that allows you to create dynamically filled web pages. Its use makes it possible to make the resource truly interactive, and the process of managing the site - simple and less costly in terms of effort. Online course PHP for Beginners by WebShake helps you learn the basics of a scripting language from scratch, learn how to create dynamic resources that are easy to modify and maintain.

Our text materials and video tutorials are designed to be understandable to every user who wants to learn web programming. And homework, placed at the end of each topic, will allow you to consolidate the knowledge gained and hone their application in practice.

Hi all!
In the PHP category, I want to create a tutorial for beginners that will allow you to know the strength and power of the basics language PHP programming . If you are interested, join my lessons.
I promise you will not be loaded with complex lessons and meaningless theory! Just practice and everything with examples.
So, the first lesson will be introductory.

We will consider:
○ What is PHP and why is it needed
○ Where PHP is used

○ How to apply PHP
○ What tools do you need to learn PHP

What is PHP and what is it for?
PHP (H ypertext Preprocessor - Hypertext Preprocessor) is a programming language. It is one of the easiest programming languages, designed specifically for creating web applications. PHP is easily embedded in .

WITH using PHP you can do a lot, for example, protect the site, create an admin panel for the site, order and feedback forms, a forum, viruses, etc.

How to apply PHP?
For PHP to work, the file must have the extension "*.php".

The PHP file must be hosted or on a local server.
In the file itself, the PHP code is specified in the following standard way:

?> – block closure for PHP code

All commands and rules are written inside the block.
See an example:

What tools do you need to learn PHP?

To learn PHP you will need:

  1. Standard Windows notepad (Start => All Programs => Accessories => Notepad) or download free editor Notepad++
  2. Download and install local server on the computer

From the author: On the World Wide Web, physical strength means nothing! You can press the keys with any force, but the result will not change. On the Internet, the one with more experience and knowledge is considered stronger. Although my friend “pumped up” the hardware of his PC so much that he became afraid of it! But this is with everything from the "iron" opera. And today we will find out in PHP where to start learning to become a strong programmer.

"Tea" disease

Of course, sorry, but you are a "teapot". How did I guess? Well, because only beginners ask themselves such questions. And there is nothing offensive in this “title”, because you have so much desire for learning that you can “boil”. And this is a sign that everything will work out!

The study of PHP, like any other science, should be started from the very beginning, that is, from the theory. You need to understand what this programming language is: its capabilities, main scope, features, and so on. This is an important aspect, since beginners, due to the lack of basic theory, general ideas about a particular language, often make the wrong choice. And after that, with deceived expectations, they quit training after several hours of “research”. I will try to lift this veil a little so that you understand not only where to start learning PHP, but also why.

A few features of the language that beginners should know:

Most often, PHP is used in website building, but it can also be used to develop client applications.

It is a server-side language - its code is executed on the server side, so you will need a local server or an appropriate assembly to learn.

Close relationship with - if you are going to “storm” site building, you will also have to learn the specified DBMS. We will help you with this.

Where is the beginning?

If you are going to learn PHP programming, but don’t know where to start, then this section is for you. You should start with the basics: with the syntax of the language, data types, variables, their initialization, loops, function declarations, etc. Even if you studied all this in other software disciplines, you will have to read it again, since PHP has a number of features.

But it will be later, but initially you need to decide on the main literature for comprehending software science. The choice of sources should be approached very seriously.

Choose a few, and read a couple of pages from each. The presentation style of the main source should be as simple and clear as possible. The success of education as a whole depends on this.

To comprehend PHP, you can use various tutorials, specialized manuals for "dummies". It would be nice to add one or more sensible ones here: the visualization of information significantly increases the assimilation of the material. But once again I repeat: where to start learning PHP and the choice of sources is up to you.

A little personal

In general, after the first semester, in terms of academic performance, I slipped to the very bottom. And all because the teachers, seeing that most of the students "swallow" all the material, even "not chewed", tried to give as much as possible. But I did not have the experience that my groupmates had.

The next semester, I transferred to a parallel group consisting of the same “dummies”. For them, the teachers “bited” and “chewed” everything, carefully explained. Here things went "on the mend", and I again became one of the best students.

I am not boasting (well, maybe a little), but I am trying to explain that you should choose the style of learning, methods of obtaining information and the duration of comprehending the discipline for yourself. In my opinion, various are an ideal source of educational information. Their selection is what you need to start learning PHP from scratch.

What you need to start development

PHP is a programming language whose code is executed on the server side. Therefore, to work with it locally, you need an appropriate software. Three main components:

PHP interpreter.

local server.

But installing each of these components can take a lot of time and effort. Especially if you are a beginner. The best option is to install a software package that includes all the components.

I recommend using Open Server. It includes everything you need to get started with PHP without much headache. The installation process is automatic (easy and fast). Just what you need for real "dummies".

I hope I managed to dispel all the doubts and questions that "haunt" newcomers. Do you feel like you've gotten stronger? You are just getting started with PHP. Soon you will be real "strongmen" in the software sciences. See you for new workouts!

From the author: Do I need to know the PHP programming language? If you are going to link your fate with website building, you will have to. Even if you really don't want to! Why is that? We will try to answer all the common “whys” associated with this language in our material.

The solution that holds the internet together

This is how a friend of mine, who has been creating Internet resources for more than a decade, described PHP. And he is right, probably 200% percent (and maybe more).

The very history of the emergence of this language suggests that it was born to "blind" the current version of the Web, to which we are so accustomed. This is probably why some people never realize its power, even after learning the basics of PHP programming.

Proving the role of PHP in creating the Internet is a thankless thing. Here, as they say, supporters of other server languages ​​can begin to speak. Like, the “hypertext preprocessor” (as the abbreviation PHP stands for) has already outlived its usefulness. Many of its features are implemented even in…

Well, yelling and waving your arms around extolling your programming language that you specialize in is no easy task. But the best "evidence" indicating the demand for PHP is its prevalence.

The following rating of programming languages, compiled by TIOBE specialists last summer, tells us that PHP has been consistently in the top for several years now. Haven't you run to look for a tutorial on the PHP programming language yet? Run soon.

If you are interested in why Java jumped like that, then I will answer: thanks to the Android mobile operating system, applications for which are developed in this language.

Own rake

Back in the early 2000s, I was engaged in “research” in the field of programming. Everyone was trying to figure out which "party" of developers should join, the study of which discipline to devote his life to.

As a PHP programming language for beginners, I did not consider in principle. He seemed too confused. Here's another ASP.NET thing: a commercial language based on C#. Oh, what castles in the air I built then! And for this there were all the prerequisites:

The technology was developed by such a "giant of thought" as Microsoft.

Availability of specialized software - a powerful Visual Studio editor.

Extensive and well described documentation.

Hope for a "healthy" future.

ASP.NET, unlike PHP, was much easier for me. Visual Studio has automated a lot of server side scripting. For example, thanks to the excellent visual editor, it took only a few minutes to create a web page. By dragging and dropping controls and styling them in the editor, you could make a website in less than an hour!

But the programming language PHP from scratch was not given to me right away. Honestly, I tried to make friends with him (I had to pass the exam somehow). But when studying its basics, it seemed to me callous and even cold.

In general, I took up ASP.NET. Made my first site. Well, everything seems to work in the development environment. Cross-browser compatibility tested in several popular browsers. I think it's time to "fight". So to speak, to show his "brainchild" to the whole country (at least). This is where the "rake" turned out to be.

My attempts to find hosting with ASP.NET support in Runet were not successful. There were, of course, several paid sites, but the prices for hosting a site on them were clearly not “student”.

Somehow I dug up a free hosting option in Burzhunet (by the way, sponsored by Microsoft). Well, he “clapped”, enjoyed the breadth of his thoughts, but things didn’t go any further. And all due to the fact that most of the sites were already made in PHP.

After you decide and understand exactly what you are ready to study PHP language programming, look for a tutorial for beginners "for yourself." The main thing is that you understand what the author of the publication wants to convey to his readers. Immediately get ready to “fork off” a good amount for high-quality literature.

But it is better to use an integrated approach - add more and sensible. This will allow you to hone your skills immediately on practical examples. And my advice to you is to do less copy-paste of code! Why, now I will explain.

When you type script examples yourself, you will quickly get used to and remember the features of PHP syntax. As for the literature, choose a tutorial with the basics of programming in PHP. And it is desirable that the author post the code of all the examples given on his resource on the Web.

Also, immediately before starting the training, download and install Open Server. This software package includes all the environments you need to write and test code.

Well, let me digress for today. Forgive (if anything) for the excessive visibility of the content of the article, but this is necessary to understand the features of this language (after all, a server one). I wish you to quickly understand the basics of the PHP programming language and start real coding!

mob_info