The PHP development team announced yesterday the immediate availability of PHP 5.4.6 and PHP 5.3.16 which fixes over 20 bugs. All users are encouraged to upgrade to the latest stable versions of PHP 5.4.x and PHP 5.3.x. Our VPS Hosting and Dedicated Hosting customers can upgrade their PHP install by using EasyApache within Web Host Manager (WHM).
PHP is one of the most popular server-side scripting languages used on the Web. It was created in 1995 by Rasmus Lerdorf, originally as a small set of Perl scripts he referred to as “Personal Home Page Tools”. By the time PHP 3 came along, it had many of the features that we use in PHP every day. In PHP 5 saw the introduction of better support for object-oriented programming (even though there was quite complete object-oriented support in PHP 4 – although in PHP 5 came the introduction of being able to change the visibility of methods and class variables. In PHP 5 also saw the introduction of the object-oriented lightweight and easy-to-use PHP Data Objects – an object-oriented interface for connecting to and performing database-related functions – was also introduced. PHP Data Objects is a good alternative to using standard procedural functions for connecting to databases, performing queries and fetching results.
There has been many controversial features in PHP that has later been deprecated and removed. One of which primarily being Magic Quotes which enabled the automatic backslashes of certain characters which assisted users in escaping input in a SQL query to prevent SQL injections occurring. However, this was widely criticised for helping inexperienced developers write insecure code because they do not otherwise need to manually sanitise input prior to input being part of an SQL query for execution. In PHP 5.4, Magic Quotes was completely removed.
New features in PHP 5.4
In PHP 5.4, some new features were introducing. As well as Magic Quotes being removed in PHP 5.4, the release also came with some good new features including:
- The short open tag (<?=) is now always available regardless of the short_open_tag option in the php.ini configuration file.
- From PHP 5.4 onwards, you can now access methods and class variables directly after instantiation of the class. Such as (new Class)->method().
- Short array syntax. For example: $array = ["Blog","Forums","Knowledgebase"] and $array = ["name_1" => "Blog, "name_2" => "Forums", "name_3" => "Knowledgebase"].
- The $this reserved variable can now be used in anonymous functions (also referred to as closures).