Wednesday, November 25, 2015

What is PHP?

PHP online

PHP is a language suitable for Web development and can be embedded into HTML very popular open source. It is popular because a large number of web pages and 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, according to rules.

PHP is used to generate dynamic web pages. Remember we call static page that the contents remain always the same, while those called dynamic pages whose content is not always the same. For example, the content can be changed based on the changes you have in a database, search or user input, etc.

PHP How does it work? The PHP language is processed on servers, which are powerful computers with special software and hardware. When a type http://www.mysite.com/index.php address into a web browser such as Internet Explorer, Firefox or Chrome, what happens? Data request to the server which processes are sent, gathers the data (that say it is a dynamic process) and the server is returning an HTML page like static.

The scheme is: Reference website 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 was dynamic (making processes so that the returned web page is not always the same).

Static Content : Reference -> 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 News page, look in the database have the latest news that you entered to display in the visitor's browser. But how do you get to the page will show new news? Simply loading them in the database, for example, through a form that fills a person and filling once when you press "Send" means that what you have written is stored in our database. Thus, when we ask the website and server refer to the database, you will find this new information and show our differently than it looked before.

Generally this kind of language is often used to create dynamic content and interact with the user.

An example of the contents of a web page php, that we will store in a file that ends with a .php extension and containing text:

<html>
<head>
<title>Example</title>
</head>
<body>
<?php
echo "Welcome to learn PHP";
?>
</body>
</html>


As you can see the contents of the file contains HTML code and at one point a <? Php means that there begins the given PHP code appears. Therefore we say that the PHP code is embedded (included or embedded) in HTML code.

Therefore the PHP pages contain HTML with PHP code in them to do "something" (in this case, display Welcome to aprenderaprogramar.com The PHP code is between special tags beginning and end. <? Php and?>

These special labels allow us to get in and out of "PHP mode". We 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 send it to the client as if it were a static website. The customer will receive the results the server returns after interpreting PHP code, with no way of determining what the result code has been received. That is, through our browser we could see the HTML code, but not the PHP code that led to 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 using 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, and much more. PHP used the web from small to large companies. Many web applications are built using PHP. We can cite Joomla and Drupal (content management of web pages), osCommerce and Prestashop (line On-for ecommerce stores), phpBB and SMF (forum systems for web pages), Moodle (learning platform for online education) etc.

PHP can also be used to present results and other data standards or own web development languages ​​such as XHTML and any other XML files. PHP can autogenerate these files and store them on 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 to other powerful languages ​​like Java.

In short, PHP is a powerful, widely used and of great interest for the web development language.

No comments:

Post a Comment