PHP 7
PHP is a server-side scripting language designed for web development but also used as a general-purpose programming language
PHP is a language suitable for web development and can be embedded in HTML very popular open source. It is popular because a large number of pages and web portals are created with PHP. Open source means that it is free and free to all developers who want to use it. Embedded in HTML it means that the same file will be able to combine PHP code with HTML code, following rules.
PHP is used to generate dynamic web pages. Remember we call static page one whose contents remain always the same, as we call dynamic those whose content is not the same forever. For example, the contents may change based on the changes you have in a database, search or user input, etc.
PHP How does it work? PHP language is processed on servers, which are powerful computers with special software and hardware. When a type http://www.aprenderaprogramar.com/index.php address is written in a web browser such as Internet Explorer, Firefox or Chrome, what happens? data request to the server which processes are sent, collects data (why say it is a dynamic process) and the server is returning an HTML page like static.
The scheme is: Request web page server -> The server receives the request, gathers the necessary information by consulting databases or other websites, other servers, etc. -> The server responds by sending a ‘normal’ website (static) but whose creation has been dynamic (making processes so that the returned web page is not always the same).
In summary:
Static pages: Request -> Answer
Dynamic pages: Reference -> Processing and preparation -> Answer
In a dynamic site, the information is generally contained in a database. Every time we show the page, such as a newswire page, look in the database the latest news we have to show you entered in the visitor’s browser. Now, how do you get that page will show new news? Just loading them in the database, for example, through a form that fills a person and once stuffed when you press “Send” implies that what is written is stored in our database. Thus, when we ask the website and see the server database, you will find this new information and show our differently than it looked before.
Generally this type of language is often used to create dynamic content and interact with the user.
Here is an example of the content of a web page php, that we will store in a file that ends with a .php extension and containing text:
Example
As you can see the contents of the file contains HTML code and at one point given a label appears
These special labels allow us to get in and out of “PHP mode”. They serve the web server to know that has to interpret the code included between these tags as PHP.
What distinguishes PHP from JavaScript is that the code is executed on the server, generating HTML and sending it to the client as if it were a static web page. The customer will receive the results the server returns after playing the PHP code without any possibility to determine what code has produced the result received. That is, through our browser we could see the HTML code, but never the PHP code that resulted in the HTML output. The web server can even be configured so that users can not know whether or not you are using PHP.
Best of use PHP is that it is extremely simple for the beginner, but in turn, offers many advanced features for professionals and advanced programmers.
With PHP you can process the form data, generate dynamic page content, or send and receive cookies, among many other things. PHP used the web pages from small to large companies. Many web applications are built using PHP. We can cite Joomla and Drupal (content management web pages), osCommerce and Prestashop (line Online e-commerce stores), phpBB and SMF (systems forums for web pages), Moodle (learning platform for online education) etc.
Among PHP skills it includes creating images from data. For example, suppose we have an academy with 20 students enrolled in a computer course, 50 students enrolled in a math course and 30 students enrolled in a chemistry course. PHP can automatically generate images similar to this:
php example
PHP can also be used and present results in other data standards or own web development languages such as XHTML and any other XML files. PHP can autogenerate these files and store them in the file system instead of presenting them on the screen, using these files to generate dynamic content. That is, dynamic content can arise from sites other databases.
You can also interact with other servers using any protocol. Finally, PHP can be linked with other powerful languages like Java.
In short, PHP is a powerful, widely used and of great interest to web development language.