As the popular PHP language continues to evolve, many new features make it more object-oriented. This article uses some PHPV5.3 instances to demonstrate delayed static binding, namespace support, class method overloading, variable parsing, and heredoc support.
Features
This article mainly describes the following features of PHP V5.3:
- Delayed static binding
- Namespace
- Class method overload
- Variable parsing and heredoc
However, you need to set PHP V5.3 before continuing.
Set
A well-known feature of PHP is that it is difficult to set up. This may be because PHP is installed on a Web server (such as Apache) and often needs to be connected to an external database (such as MySQL ). In a sense, PHP scripts are embedded in HTML code. In other words, PHP is a technology that spans multiple complex fields. Therefore, you must overcome many obstacles before writing PHP script code. I hope this situation can be improved, but many things related to software technology are still very difficult.
However, for those lucky readers who use Apple Macs, the setting process is much simpler:
- Get the PHP binary installation file (http://www.entropy.ch/software/macosx/php ).
- Disable Web Sharing in System Preferences.
- Find the/etc/apache2/httpd. conf file.
- Comment out the following line in the httpd. conf file: LoadModule php5_module.
- Run the PHP V5.3 installation file (you can also build the source code if you want ).
- Open Web Sharing in System Preferences.
The purpose of this article is not just to introduce how to install, so if your platform is Microsoft®Windows®Or Linux®For more information, see some excellent PHP reference books (see the books I recommend in reference materials ).
To check whether PHP is installed and the version is appropriate, create a file named phpinfo1.php in the/Library/WebServer/Documents folder. Listing 1 shows the content of this script file. All the scripts in this article are in the compressed (ZIP) file provided in the download section, so you do not need to create any files.
Listing 1. phpinfo1.php
Put the script file in the/Library/WebServer/Documents folder and access http: // localhost/phpinfo1.php. You can see a page similar to Figure 1. Here, you may need to replace "localhost" in the URL with the IP address of your host ".