Knowing how PHP works

PHP is a programming language frequently used for creating content for web sites with which you can program html pages and source codes. PHP is a recursive acronym what does it mean "PHP Hhypertext Pre-processor »(initially PHP Tools, or, Personal Home Page Tools), and it is a interpreted language used for creating applications for servers, or creating dynamic content for websites. Lately also for the creation of other types of programs including applications with graphical interface using the libraries Qt o GTK +.

USE OF PHP

The main uses of PHP are the following:

  • Schedule of web dynamics, usually in combination with the database engine MySQL, although it has native support for other engines, including the standard ODBC, which greatly expands your connection possibilities.
  • Console programming, in the style of Perl or shell scripting.
  • Creation of browser-independent graphical applications, through the combination of PHP and Qt/GTK +, allowing you to develop desktop applications in the OS in which it is supported.

ADVANTAGES OF PHP

  • It's a multiplatform language.
  • Ability to connect with most of the database drivers that are used today, highlights its connectivity with MySQL
  • Read and manipulate data from various sources, including data that users can enter from HTML forms.
  • Ability to expand its potential using the huge number of modules (called ext's or extensions).
  • It has extensive documentation on its official website ([1]), among which it stands out that all the system functions are explained and exemplified in a single help file.
  • Es spirit, so it is presented as an easily accessible alternative for everyone.
  • Allows the techniques of Object-oriented programming.
  • Allows you to create the forms for the web.
  • Extremely comprehensive and included native library of functions
  • It does not require definition of variable types or detailed low-level handling.

Here is an example of a simple web page developed using the PHP language.

Example

<?php

if (isset($ _ POST['shows'])) {

     threw out 'Hi there, '.htmlentities($ _ POST['Name'])

         .', your favorite food is:'. htmlentities($ _ POST['food']);

} else {

?>

<form method="POST" action ="?"> What is your name?"Text" name ="Name"> What is your favorite food?"food"> Spaghetti Roast Pizza"submit" name ="shows" value ="Follow">

<?php

}

?>



In this code it is possible to observe the following characteristics:

  • The variables sent by a form using the POST method, are received in the language inside the array $_POST, which facilitates obtaining this type of data. This same method is used by the language for all sources of information in a web application, such as cookies in the matrix $_COOKIES, URL variables in $_GET (which in forms can be used to save the data), session variables using $_SESSION, and server and client variables through the array $_SERVER.
  • The PHP code is embedded within the HTML and interacts with it, allowing you to design the Web page in a common editor HTML and add the dynamic code inside the tags <?php ?>.
  • The result shows and hides certain portions of the code HTML conditionally.
  • It is possible to use language-specific functions for Web applications such as htmlentitites(), which converts characters that have some special meaning in code HTML or that could be erroneously displayed in the browser as accents or umlauts, in their equivalent in format HTML..

If you want to continue knowing a little more in depth about the most Popular Free Language, you can visit the official website


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.