New Release PHP 5.4.0

New PHP Version 5.4.0 is planned to be released on February, 2 2012. It is a result of many months of development.

In the PHP Version 5.4.0 many features included. Some features are listed below.

  • Traits
  • Built-in Web server
  • Binary notation for integer values
  • Array short syntax
  • Annotations


PHP does not support multiple inheritance. This means that unlike languages such as C++, it is not possible to create one class by inheriting the behavior of multiple other classes.

However, PHP implements the support to have classes with multiple interfaces since version 5. This is a simple approach inspired in Java that avoids the ambiguity problems of C++ multiple inheritance implementation.

The problem of using either multiple inheritance or multiple interfaces is that it becomes easy for creating bloated classes that have much more inherited functions than they may really need in practice.

Traits provide a simpler alternative. You can define a trait practically the same way you define a class or an interface with whatever functions you need. Then you use them in a new class you want to have those functions.

Here is an example taken from the original proposal RFC document:


  trait ezcReflectionReturnInfo {
    function getReturnType() { /*1*/ }
    function getReturnDescription() { /*2*/ }

  class ezcReflectionMethod extends ReflectionMethod {
    use ezcReflectionReturnInfo;
    /* ... */

  class ezcReflectionFunction extends ReflectionFunction {
    use ezcReflectionReturnInfo;
    /* ... */


Built-in Web server

Although Apache has been losing popularity in the latest years for more efficient Web servers in use in production environments, it is still very popular among PHP developers that use it to test their applications in their development environments.

However, Apache is still too cumbersome and complicated to configure, especially when you just want to set it up for a simple development environment. Therefore, PHP 5.4 introduces a Web server that comes built in the PHP command line version.

This means that you only need to execute a simple PHP command and you have Web server running ready for you to test your applications without depending on setting Apache or any other external Web server.

Another interesting purpose of this built-in Web server is that you can develop browser based applications that run in the local machine and you only need the base PHP installation for that.

Here is an example command of how to run PHP to work as a Web server.

$ php -S localhost:8000

 Server is listening on localhost:8000... Press CTRL-C to quit.
 [Thu Mar  3 05:42:06 2011] ::1:56258: /
 [Thu Mar  3 05:42:06 2011] ::1:56259: /?=PHPE9568F34-A769-00AA02
 [Thu Mar  3 05:42:06 2011] ::1:56260: /?=PHPE9568F35-A769-00AA04

Binary notation for integer values

When you need to use literal values in your PHP code you can represent them in decimal, hexadecimal or octal. Now in PHP 5.4 you can also represent them in binary.

In octal you would need to prefix the value with a 0. For instance, 010 represents the number 8, not 10 as some may expect. In hexadecimal you would need to prefix the values with 0x, for instance 0x12 represents the number 18. In binary you need to prefix the number with 0b, for instance 0b101 represents the number 5.

Array short syntax

The popularity of JSON made it a common format for exchanging serialized data between code eventually written on different languages.

One basic difference between JSON and PHP literal value format is that arrays are represented by brackets instead the usual array() construct. Some people proposed to add support for a shorter syntax similar to JSON, but the proposal was not approved by PHP core developers.


Annotations are a form of adding metadata to your code. The metadata information can be used by those tools for instance to produce additional support code, so you do not have to write such code manually. One common use is to generate PHP code or SQL statements to map data between class objects and database tables.

There were several proposals to implement annotations in PHP, very similar to the way they work in other languages like Java and C#. Those proposals ended up not being accepted or fully implemented to make into PHP 5.4.

Still, there are alternative approaches that consist in separate annotation parser tools that extract annotation metadata from PHP comments.

Mobile Wallet (Final Year Project)

The Mobile Wallet and Banking Platform provides a foundation for Mobile Operators, Banking, and Mobile Commerce Vendors to rapidly develop and launch customized services to mobile subscribers.

This platform provides the following core features and functionality:

  • Mobile Banking, Mobile Wallet, &MobileMoney Transfer Applications
  • Financial Account Association and Subscriber Registration
  • Customer Relationship Management and Operational Support Software
  • Connection toMobileMoney Transfer Networks
  • Connection to Bank Processors and Payment Gateways
  • SMSc/USSD Integration for Messaging and Alerts
  • Transaction Monitoring and Reports

The platform includes a comprehensive suite of development and testing tools that enable financial institutions to expedite delivery of mobile financial services. This flexible platform empowers clients to tailor DonRiver Solutions to their unique requirements, launch new digital channels for interacting with customers, and build new financial products and services leveraging existing systems.

Using one’s handset as a financial tool, or the mobile wallet is an interesting concept which is becoming increasingly popular and integrated across consumer platforms. Not only does it allow users on the move to access financial accounts, but also plays an integral part in the development of digital commerce and banking.

The mobile wallet is proving especially effective in developing countries where desktop access to the Internet and banking opportunities are still a privilege, yet mobile accessibility is extremely high.