Hypertext Preprocessor | PHP | Part 2

Hypertext Preprocessor | PHP | Part 2

PHP Features

Advantages of PHP

  • It is a multi-platform language.
  • Fully guided the development of dynamic web applications with access to information stored in a database.
  • Source code written in PHP is invisible to the browser and the client, and the server is in charge of running the code and sends it to the HTML output to the browser. This makes programming in PHP safe and reliable.
  • Ability to connect to most database engines used today, highlights its connectivity with MySQL and PostgreSQL.
  • Ability to expand their potential by using the vast amount of modules (called ext’s or extensions).
  • He has extensive documentation on their official website, among which stands out all the functions of the system are explained and exemplified in a single help file.
  • It is free, what is presented as an alternative accessible to everyone.
  • Allows you to apply techniques of object-oriented programming.
  • Native library functions and included very broad.
  • Does not require definition of types of variables but the variables can be evaluated also by the guy who is handling at run time.
  • Has exception handling (from PHP5).
  • While PHP does not require the wearer to follow a particular methodology to the programming (many other languages do not) even led to one in particular, the programmer can use in their work any programming technique and / or development that allows you to write code organized, structured and manageable. An example of this are the developments that have made PHP Design Pattern Model View Controller (or MVC), which allows separate treatment and access to data, control logic and user interface into three separate components.

Disadvantages

A language that is interpreted execution for certain applications it may be inconvenient to the source code can not be hidden. Obfuscation is a technique that can be difficult to read the code, but fails to prevent and separate in some cases represents a cost in execution time.

Type hinting

Accordingly, it was added a feature called induction-type, according to which we can have some typing when we pass objects to the parameters of a function (or method), something unthinkable in the previous version.

Visibility

The visibility of a property or method can be defined with the following access modifiers: public, protected or private. Items declared as public can be accessed by the object (class instance). Protected members are accessible to child classes (inherited). The private visibility limited to just the class that defines the attribute or method.

PHP and Polymorphism:

Parametric Polymorphism

In parametric polymorphism, an object can even be used uniformly as a parameter in different contexts without changes. A method that exhibits parametric polymorphism (also called generic method) allows the type of its argument is determined by a parameter of type implicit or explicit, performing the same transaction, regardless of the type of argument. PHP does not require (or support) explicit type definition in variable declaration: the type of a variable is determined by:

  • Context in which the variable is used. This means that if you assign a string value to variable $ var, $ var becomes a string.
  • If you then assign an integer value to $ var, it becomes an integer. So PHP does not adopt this type of polymorphism, because it has no generic parameters.

Polymorphism of Inclusion

Polymorphism for inclusion in an object can be seen as belonging to different classes which need not be disjoint. PHP takes this type of polymorphism, because it is an object-oriented language that allows inheritance capabilities.

Polymorphism by Overloading

Polymorphism due to overload, this is a method of polymorphism in which more than one method has the same name but different signatures, is not supported by PHP.

Polymorphism by Coercion

PHP also supports polymorphism by coercion, in which the language has a semantic operation to convert an argument to an expected type for a function, a situation that would otherwise result in a type error.
The next version: PHP 6 is under development.

PHP is used mainly as a server-side scripting language, which means that it is the server (the machine that hosts the Web page in question) who will interpret the PHP code and generate code (generally consisting of ‘XHTML or HTML, CSS, JavaScript and sometimes) that can be interpreted by a browser. PHP can also generate other formats in connection with the Web, such as WML, SVG, PDF, or bitmap images such as JPEG, GIF or PNG.

It was designed to allow the creation of dynamic applications, mostly devoted to the Web. PHP is overwhelmingly installed on an Apache server, but can be installed on the other main HTTP server market, such as IIS. This coupling is used to retrieve information from a database, a file system (file content and the tree) or simply data sent by the browser to be read or stored for later use

It is a typed language and little flexible and thus easy to learn for a beginner, but this fact, security vulnerabilities can quickly appear in applications. Pragmatic, PHP is not encumbered by theory and tends to choose the most direct route. However, the function names (and argument passing) do not always follow a unified logic, which may be detrimental to learning.

Its use begins with the processing of forms and through access to databases. Access to databases is easy once the corresponding completed installation of modules on the server. The most obvious strength of this language is that it has over time the easy production of complicated problems previously and became therefore an essential component of offers of accommodation.

It is multi-platform: Linux with Windows as it can easily extend the same code in an environment somewhat similar (taking into account the rules of directory trees that can change).

Free, free, easy to use and install, this language requires any programming language as a good understanding of the key features common acute and knowledge of safety issues related to language.

Version 5.3 has introduced many features:

Namespaces – a fundamental element of the development of extensions, libraries and frameworks structured – anonymous functions, closures, etc. Version 6 will introduce the internal ICU library giving the language the ability to handle Unicode natively.

Operation

PHP is part of the large family of descendants of C, whose syntax is very close. In particular, its syntax and its construction are similar to those of Java and Perl, with the difference that PHP code can easily be mixed with HTML code in a PHP file.

In a web usage, execution of PHP code runs well: when a visitor requests a web page, the browser sends a request corresponding to the HTTP server. If the page has been identified as a PHP script (usually with the extension .php), the server calls the PHP interpreter will process and generate the final code of the page (generally consisting of HTML or XHTML, but also often CSS and JS). This content is returned to the HTTP server, which sends it to the end customer.

Different platforms

A Web server three-tier architecture is composed of an operating system, an HTTP server, a server language and finally a basic management system (DBMS), it constitutes a platform.

In the case of PHP as a language server, the most common combinations are those of a platform LAMP (Linux Apache MySQL PHP) and WAMP (Windows Apache MySQL PHP). WAMP platform is generally installed via a single software that integrates Apache, MySQL and PHP, such as EasyPHP, VertrigoServ, or UwAmp WampServer. There is the same type of software for platforms MAMP (Mac OS Apache MySQL PHP), like the software MAMP.

There are other variants, such as platforms LAPP (the M is replaced by the MySQL PostgreSQL P) or software XAMPP (Apache MySQL PHP Perl and the X indicates that the software is cross-platform), kit cross-platform development.

We may decline a wide variety of acronyms that form. Confusion can sometimes exist between the platform itself and the software to install, if they have the same name. It should also be noted that the vast majority of software “all in one” are intended for Web application development locally, and not to be installed on Web servers. An exception to this rule is perhaps the range of products distributed by Zend Technologies, Zend Core and Zend particular Server that are designed to operate both in development environment and production.

Acceleration

PHP is basically an interpreted language, which is detrimental to the speed of code execution. Its high popularity associated with its use on websites with very heavy traffic (Yahoo, Facebook) have led a number of people seeking to improve its performance in order to serve a greater number of users of these Web sites without requiring purchase of new servers.

Continued…

Sharing

Leave your comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.