What is PHP
PHP is the acronym for Hypertext Preprocessor, something like hypertext preprocessor, a programming language widely used primarily for web development. Despite having the PHP-GTK version for desktop environment. In the course of our learning we will focus on PHP for web development.
Is PHP free?
Yes! For starters PHP is open source, ie open source. So to get PHP the only thing you have to do is log into the PHP website and download the newer version. Because with the latest version will have new features and possible bugs have been fixed.
PHP and HTML
A PHP page usually has the extension .php (depending on your web server configuration). However, on these pages with the extension .php you can usually enter the HTML code you are already used to developing. And it will work like this, whenever the server receives pages with the extension .php it will know that the programming language on the page interpreting HTML, and finding PHP code interpreting them, or vice versa and more than once because it doesn’t matter how many times you switch between HTML and PHP code and whether you start code with one or the other. In short we can write HTML and PHP in a .php file that everything will be interpreted correctly.
PHP, Server-side and Client-side
The opposite of client-side. Here the information is processed by a web server that will interpret and return the result that will be displayed in the browser. Therefore it is not possible to view the code of an application running on Server-side.
What about PHP?
PHP is processed on the server so it is a server-side language. Therefore your applications cannot be copied by other people. All processes, routines and functions will be done on the server and the user will only receive the result in their browser.
What can we do with PHP
First transformation of static sites, which do not have any interaction, into dynamic sites, with greater possibility of interaction and dynamism. For example, with static pages we can not have a comment session on our site, in which when you finish reading an article the person completes a field in the form and leave your opinion and on the same shelf your opinion is on the site, things we can perform with PHP and a database.
Imagine a site that has 10 items in the site menu and each item opens 5 more internal pages, we have a total of 50 pages. Now imagine the situation: Your customer calls you and asks you to enter one more item in the menu, remembering that the menu is present on every page, what would you do? It would probably open the 50 pages and copy and paste the menu code between them, very annoying legwork right?, Besides possible errors. But the more you inserted the item in the menu, you must have thought that the problem is over, but not the next day, but the next day the item in the menu that your customer had called contact actually sent him the wrong name because the marketing people found out That the name speaks to us has greater appeal with customers. And there you go again for the same legwork.
What if it was news that should be entered 3 times a day? Your client would send it to you, you would include it, and whenever there were errors you would have to go there and correct them. Besides having a call with all the news you should update as well and a photo call on the homepage. Boring process for you and the customer.
With PHP we can separate in the first case the menu in a file that when updated would be updated throughout the site, because this menu would be inserted in all pages by PHP.
And in the second case of the news we could create an administrative area where only logged in users, administrators would have access and could enter and edit the news without having to contact you.
PHP and the database
PHP has access to several databases. Thus you will have a number of functions to be able to use between the various types of databases supported by PHP. In our learning we will use MySQL.
Example applications we can develop with PHP
With PHP we can develop things like restricted areas that require authentication, article commenting systems, news etc. Sending emails, news systems, online stores, social networks and anything else you can imagine.
One large web application that was developed in PHP was Wikipedia. In it you will find several things like the authentication system, article publishing and editing, photo uploads among others.