Frogg logo

Frogg's web tools

Hand Crafted Tools

Home > Coding PHP > PHP - Introduction
Welcome on Frogg's web tools | Current date :
11/12/2018

PHP - Introduction

PHP is a server-side scripting language designed for web development but also used as a general-purpose programming language.
Originally created by Rasmus Lerdorf in 1994, the PHP reference implementation is now produced by The PHP Group.
PHP originally stood for Personal Home Page, but it now stands for the recursive acronym PHP: Hypertext Preprocessor.

During 2014 and 2015, a new major PHP version was developed, which was numbered PHP 7.
The numbering of this version involved some debate.
While the PHP 6 Unicode experiment had never been released, several articles and book titles referenced the PHP 6 name, which might have caused confusion if a new release were to reuse the name.
After a vote, the name PHP 7 was chosen.

source wikipedia

PHP major updates

https://www.java-samples.com/showtutorial.php?tutorialid=889
https://php.net/manual/en/history.php.php

PHP/FI 2

A rewrite came with PHP/FI 2 in 1997, but at that time the development was almost solely handled by Rasmus. After its release in November of that year, Andi Gutmans and Zeev Suraski bumped into PHP/FI while looking for a language to develop an e-commerce solution as a university project. They discovered that PHP/FI was not quite as powerful as it seemed, and its language was lacking many common features. One of the most interesting aspects included the way while loops were implemented. The hand-crafted lexical scanner would go through the script and when it hit the while keyword it would remember its position in the file. At the end of the loop, the file pointer sought back to the saved position, and the whole loop was reread and re-executed.

PHP 3

Zeev and Andi decided to completely rewrite the scripting language. They then teamed up with Rasmus to release PHP 3, and along also came a new name: PHP: Hypertext Preprocessor, to emphasize that PHP was a different product and not only suitable for personal use. Zeev and Andi had also designed and implemented a new extension API. This new API made it possible to easily support additional extensions for performing tasks such as accessing databases, spell checkers and other technologies, which attracted many developers who were not part of the "core" group to join and contribute to the PHP project. At the time of PHP 3’s release in June 1998, the estimated PHP installed base consisted of about 50,000 domains. PHP 3 sparked the beginning of PHP’s real breakthrough, and was the first version to have an installed base of more than one million domains.

PHP 4

In late 1998, Zeev and Andi looked back at their work in PHP 3 and felt they could have written the scripting language even better, so they started yet another rewrite. While PHP 3 still continuously parsed the scripts while executing them, PHP 4 came with a new paradigm of "compile first, execute later." The compilation step does not compile PHP scripts into machine code; it instead compiles them into byte code, which is then executed by the Zend Engine (Zend stands for Zeev & Andi), the new heart of PHP 4. Because of this new way of executing scripts, the performance of PHP 4 was much better than that of PHP 3, with only a small amount of backward compatibility breakage.
Among other improvements was an improved extension API for better run-time performance, a web server abstraction layer allowing PHP 4 to run on most popular web servers, and lots more. PHP 4 was officially released on May 22, 2002, and today its installed base has surpassed 15 million domains. In PHP 3, the minor version number (the middle digit) was never used, and all versions were numbered as 3.0.x. This changed in PHP 4, and the minor version number was used to denote important changes in the language. The first important change came in PHP 4.1.0, which introduced superglobals such as $_GET and $_POST .
Superglobals can be accessed from within functions without having to use the global keyword. This feature was added in order to allow the register_globals INI option to be turned off. register_globals is a feature in PHP which automatically converts input variables like "?foo=bar" in https://php.net/?foo=bar to a PHP variable called $foo. Because many people do not check input variables properly, many applications had security holes, which made it quite easy to circumvent security and authentication code.
With the new superglobals in place, on April 22, 2002, PHP 4.2.0 was released with the register_globals turned off by default. PHP 4.3.0, the last significant PHP 4 version, was released on December 27, 2002. This version introduced the Command Line Interface (CLI), a revamped file and network I/O layer (called streams), and a bundled GD library. Although most of those additions have no real effect on end users, the major version was bumped due to the major changes in PHP’s core.

PHP 5

Soon after, the demand for more common object-oriented features increased immensely, and Andi came up with the idea of rewriting the objected-oriented part of the Zend Engine. Zeev and Andi wrote the "Zend Engine II: Feature Overview and Design" document and jumpstarted heated discussions about PHP’s future. Although the basic language has stayed the same, many features were added, dropped, and changed by the time PHP 5 matured. For example, namespaces and multiple inheritance, which were mentioned in the original document, never made it into PHP 5. Multiple inheritance was dropped in favor of interfaces, and namespaces were dropped completely. You can find a full list of new features in Chapter, "What Is New in PHP 5?" PHP 5 is expected to maintain and even increase PHP’s leadership in the web development market. Not only does it revolutionizes PHP’s objectoriented support but it also contains many new features which make it the ultimate web development platform. The rewritten XML functionality in PHP 5 puts it on par with other web technologies in some areas and overtakes them in others, especially due to the new SimpleXML extension which makes it ridiculously easy to manipulate XML documents. In addition, the new SOAP, MySQLi, and variety of other extensions are significant milestones in PHP’s support for additional technologies.

PHP 6

PHP has received criticism due to lacking native Unicode support at the core language level, instead only supporting byte strings. In 2005, a project headed by Andrei Zmievski was initiated to bring native Unicode support throughout PHP, by embedding the International Components for Unicode (ICU) library, and representing text strings as UTF-16 internally. In March 2010, the project in its current form was officially abandoned, and a PHP 5.4 release was prepared containing most remaining non-Unicode features from PHP 6, such as traits and closure re-binding.

PHP 7

During 2014 and 2015, a new major PHP version was developed, which was numbered PHP 7. The numbering of this version involved some debate. While the PHP 6 Unicode experiment had never been released, several articles and book titles referenced the PHP 6 name, which might have caused confusion if a new release were to reuse the name. After a vote, the name PHP 7 was chosen. The foundation of PHP 7 is a PHP branch that was originally dubbed PHP next generation (phpng). It was authored by Dmitry Stogov, Xinchen Hui and Nikita Popov, and aimed to optimize PHP performance by refactoring the Zend Engine to use more compact data structures with improved cache locality while retaining near-complete language compatibility. Major versions of PHP are allowed to break backward-compatibility of code and therefore PHP 7 presented an opportunity for other improvements beyond phpng that require backward-compatibility breaks, including wider use of exceptions, reworking variable syntax to be more consistent and complete, and the deprecation or removal of various legacy features.

PHP new features

  • PHP 5.0
    In PHP 5 there is a new Object Model. PHP's handling of objects has been completely rewritten, allowing for better performance and more features. In previous versions of PHP, objects were handled like primitive types (for instance integers and strings). The drawback of this method was that semantically the whole object was copied when a variable was assigned, or passed as a parameter to a method. In the new approach, objects are referenced by handle, and not by value (one can think of a handle as an object's identifier).
  • PHP 5.1
    • A complete rewrite of date handling code, with improved timezone support.
    • PHP Data Objects (PDO) extension is now enabled by default.
    • Significant performance improvements compared to PHP 5.0.X.
    • Over 30 new functions in various extensions and built-in functionality.
    • Over 400 various bug fixes.
  • PHP 5.2
  • PHP 5.3
    • Added PHP FastCGI Process Manager (FPM).
    • New file format PHP Archive (phar).
    • Support for namespace has been added
    • Support for Late Static Bindings (LSB) has been added.
    • Support for jump labels (limited goto) has been added.
    • Support for native Closures (Lambda/Anonymous functions) has been added.
    • There are two new magic methods, __callStatic() and __invoke().
    • Nowdoc syntax is now supported, similar to Heredoc syntax, but with single quotes.
    • It is now possible to use Heredoc to initialize static variables and class properties/constants.
    • Heredoc may now be declared using double quotes, complementing the Nowdoc syntax.
    • Constants can now be declared outside a class using the const keyword.
    • The ternary operator now has a shorthand form: (cond)?(true:)(false).
    • The HTTP stream wrapper now considers all status codes from 200 to 399 to be successful.
    • Dynamic access to static methods is now possible.
    • Exceptions can now be nested.
    • A garbage collector for circular references has been added, and is enabled by default.
    • The mail() function now supports logging of sent email via the mail.log configuration directive. (Note: This only applies to email sent through this function.)
  • PHP 5.4
    • Support for traits has been added.
    • Short array syntax has been added, e.g. $a = [1, 2, 3, 4]; or $a = ['one' => 1, 'two' => 2, 'three' => 3, 'four' => 4];.
    • Function array dereferencing has been added, e.g. foo()[0].
    • Closures now support $this.
    • <?= is now always available, regardless of the short_open_tag php.ini option.
    • Class member access on instantiation has been added, e.g. (new Foo)->bar().
    • Class::{expr}() syntax is now supported.
    • Binary number format has been added, e.g. 0b001001101.
    • Improved parse error messages and improved incompatible arguments warnings.
    • The session extension can now track the upload progress of files.
    • Built-in development web server in CLI mode.
  • PHP 5.5
  • PHP 5.6
    • Added Constant expressions.
    • Variadic functions can now be implemented using the ... operator, instead of relying on func_get_args().
    • Arrays and Traversable objects can be unpacked into argument lists when calling functions by using the ... operator.
    • A right associative ** operator has been added to support exponentiation, along with a **= shorthand assignment operator.
    • The use operator has been extended to support importing functions and constants in addition to classes.
    • PHP now includes an interactive debugger called phpdbg implemented as a SAPI module.
    • default_charset is now used as the default character set for the htmlentities(), html_entity_decode() and htmlspecialchars() functions.
    • php://input may now be reopened and read as many times as required.
    • Files larger than 2 gigabytes in size are now accepted in uploads.
    • GMP objects now support operator overloading and casting to scalar types.
    • The hash_equals() function has been added to compare two strings in constant time.
    • The __debugInfo() magic method has been added to allow objects to change the properties and values that are shown when the object is output using var_dump().
    • The gost-crypto hash algorithm has been added.
    • A wide range of improvements have been made to the SSL/TLS support in PHP 5.6. These include enabling peer verification by default, supporting certificate fingerprint matching, mitigating against TLS renegotiation attacks, and many new SSL context options to allow more fine grained control over protocol and verification settings when using encrypted streams.
    • The pgsql extension now supports asynchronous connections and queries, thereby enabling non-blocking behaviour when interacting with PostgreSQL databases.
  • PHP 7.0
    • Scalar type declarations come in two flavours: coercive (default) and strict.
    • PHP 7 adds support for return type declarations.
    • The null coalescing operator ?? has been added as syntactic sugar for the common case of needing to use a ternary in conjunction with isset().
    • The spaceship <=> operator is used for comparing two expressions. It returns -1, 0 or 1 when $a is respectively less than, equal to, or greater than $b.
    • Array constants can now be defined with define().
    • Support for anonymous classes has been added via new class.
    • This takes a Unicode codepoint in hexadecimal form, and outputs that codepoint in UTF-8 to a double-quoted string or a heredoc.
    • Closure::call() is a more performant, shorthand way of temporarily binding an object scope to a closure and invoking it.
    • Filtered unserialize() : This feature seeks to provide better security when unserializing objects on untrusted data. It prevents possible code injections by enabling the developer to whitelist classes that can be unserialized.
    • The new IntlChar class seeks to expose additional ICU functionality.
    • Expectations are a backwards compatible enhancement to the older assert() function.
    • Classes, functions and constants being imported from the same namespace can now be grouped together in a single use statement.
    • Generator Return Expressions : This feature builds upon the generator functionality introduced into PHP 5.5. It enables for a return statement to be used within a generator to enable for a final expression to be returned (return by reference is not allowed).
    • Generators can now delegate to another generator, Traversable object or array automatically, without needing to write boilerplate in the outermost generator by using the yield from construct.
    • The new intdiv() function performs an integer division of its operands and returns it.
    • session_start() now accepts an array of options that override the session configuration directives normally set in php.ini.
    • The new preg_replace_callback_array() function enables code to be written more cleanly when using the preg_replace_callback() function.
    • CSPRNG Functions : Two new functions have been added to generate cryptographically secure integers and strings in a cross platform way: random_bytes() and random_int().
    • list() can always unpack objects implementing ArrayAccess.
    • Class member access on cloning has been added, e.g. (clone $foo)->bar().
  • PHP 7.1
    • Nullable types : Type declarations for parameters and return values can now be marked as nullable by prefixing the type name with a question mark. This signifies that as well as the specified type, NULL can be passed as an argument, or returned as a value, respectively. function f() : ?string
    • Void functions : A void return type has been introduced. function f() : void
    • The shorthand array syntax [] may now be used to destructure arrays for assignments (including within foreach), as an alternative to the existing list() syntax, which is still supported.
    • Support for specifying the visibility of class constants has been added.
    • A new pseudo-type (similar to callable) called iterable has been introduced.
    • Multiple exceptions per catch block may now be specified using the pipe character |.
    • You can now specify keys in list(), or its new shorthand [] syntax.
    • Support for negative string offsets has been added to the string manipulation functions accepting offsets, as well as to string indexing with [] or {}.
    • Support for AEAD (modes GCM and CCM) have been added by extending the openssl_encrypt() and openssl_decrypt() functions with additional parameters.
    • A new static method has been introduced to the Closure class to allow for callables to be easily converted into Closure objects.
    • A new function called pcntl_async_signals() has been introduced to enable asynchronous signal handling without using ticks (which introduce a lot of overhead).
    • HTTP/2 server push support in ext/curl
  • PHP 7.2
    • A new type, object, has been introduced that can be used for (contravariant) parameter typing and (covariant) return typing of any objects.
    • Shared extensions no longer require their file extension (.so for Unix or .dll for Windows) to be specified.
    • Abstract methods can now be overridden when an abstract class extends another abstract class.
    • The modern Sodium cryptography library has now become a core extension in PHP.
    • Argon2 has been added to the password hashing API.
    • PDO's string type has been extended to support the national character type when emulating prepares.
    • The PDOStatement::debugDumpParams() method has been updated to include the SQL being sent to the DB.
    • Support for EXOP has been added to the LDAP extension.
    • The sockets extension now has the ability to lookup address information.
    • Parameter types from overridden methods and from interface implementations may now be omitted.
    • A trailing comma can now be added to the group-use syntax introduced in PHP 7.0.
    • The proc_nice() function is now supported on Windows.
    • The pack() and unpack() functions now support float and double in both little and big endian.
    • The EXIF extension has been updated to support a much larger range of formats.
    • New features in PCRE : The J modifier for setting PCRE_DUPNAMES has been added
    • SQLite3::openBlob() now allows to open BLOB fields in write mode
    • Support for Oracle Database Transparent Application Failover (TAF) callbacks has been added.
    • Enhancements to the ZIP extension : Read and write support for encrypted archives has been added (requires libzip 1.2.0).

Folowing PHP evolution

PHP Extensions

There is 4 types of PHP extensions
  • Core Extensions
  • Bundled Extensions
  • External Extensions
  • PECL Extensions
Official : PHP Extensions list
Official : PECL
Available extensions on a PHP server can be visualized with following php commands:
  • phpinfo()
  • php -m
  • php -i

PHP Librairies/CMS/FrameWork

Librairies

definition

A library is also a collection of implementations of behavior, written in terms of a language, that has a well-defined interface by which the behavior is invoked. For instance, people who want to write a higher level program can use a library to make system calls instead of implementing those system calls over and over again. In addition, the behavior is provided for reuse by multiple independent programs.
source wikipedia

composer

Composer is a tool for dependency management in PHP. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you.
Official link : getcomposer.org

CMS

definition

A content management system (CMS) is a computer application that supports the creation and modification of digital content. It typically supports multiple users in a collaborative environment.

CMS features vary widely. Most CMSs include Web-based publishing, format management, history editing and version control, indexing, search, and retrieval. By their nature, content management systems support the separation of content and presentation.

A web content management system (WCM or WCMS) is a CMS designed to support the management of the content of Web pages. Most popular CMSs are also WCMSs. Web content includes text and embedded graphics, photos, video, audio, maps, and program code (e.g., for applications) that displays content or interacts with the user.

source wikipedia

some famous PHP CMS

FrameWork

definition

In computer programming, an application framework consists of a software framework used by software developers to implement the standard structure of application software.

Application frameworks became popular with the rise of graphical user interfaces (GUIs), since these tended to promote a standard structure for applications. Programmers find it much simpler to create automatic GUI creation tools when using a standard framework, since this defines the underlying code structure of the application in advance. Developers usually use object-oriented programming (OOP) techniques to implement frameworks such that the unique parts of an application can simply inherit from classes extant in the framework.

source wikipedia

some famous PHP FrameWork

PHP framewoks from wikipedia
    • Symfony - a web framework in MIT license, PHP 7 compatible.
    • Dframe Framework - open-source a framework in MIT license.
    • Laravel - open-source compatible PHP 7 (HMVC).
    • Agavi - an open source framework written in PHP5.
    • Atomik Framework - an open-source micro framework written in PHP5.
    • CakePHP - un framework web open-source écrit en PHP.
    • CodeIgniter - an open-source web framework written in PHP.
    • FuelPHP - a PHP 7 open-source web framework implementing the HMVC design pattern.
    • Hoa - a set of PHP libraries.
    • Horde - a groupware application development framework.
    • Jelix - a PHP5 framework, offering MVC.
    • KumbiaPHP - PHP5 open-source framework based on MVC and Active Record.
    • Mkframework - PHP5 MVC framework (compatible php7) backward compatible since 2009 (LGPLv3).
    • MODx - content management framework (CMF = CMS + framework) in PHP5 and open-source (GPL).
    • PEAR - a component development framework written in PHP.
    • Phalcon - a framework written in C adding as PHP module.
    • PHP Tool Suite - an open-source framework.
    • PRADO - an open-source web framework oriented object.
    • QCodo - an open-source MVC framework for PHP 5.
    • Seagull (en) - an open-source framework compatible with PHP versions 4 and 5.
    • Slim php - a micro framework web in license MIT, compatible PHP 7.
    • WebSite-PHP - object-oriented PHP frameWork and event programming.
    • Yii - framework focused on the development of scalable applications.
    • Zend Framework - the framework supported by Zend Technologies and IBM, PHP 7 compatible.
Page created by the 11/02/2018 00:05
Generated in 0.039 sec & displayed in ... sec