Upgrade PHP5.2 to 5.3 (1)

Source: Internet
Author: User
Tags dbase ereg mathematical functions php windows sybase client microsoft iis
PHP5.3 has been out for a long time, and there has been no time to see the difference between the two. Now that 5.2 is no longer sustain, we should consider migration for 5.3 later. So let's take a look. 1. What changes does PHP5.3 make? 5.3 still retains most of the forward compatibility. However, some of them are incompatible. First, let's look at incompatibility.

PHP5.3 has been out for a long time, and there has been no time to see the difference between the two. Now that 5.2 is no longer sustain, we should consider migration for 5.3 later. So let's take a look. 1. What changes does PHP5.3 make? 5.3 still retains most of the forward compatibility. However, some of them are incompatible. First, let's look at incompatibility.

PHP5.3 has been out for a long time, and there has been no time to see the difference between the two.

Now that 5.2 is no longer sustain, we should consider migration for 5.3 later.

So let's take a look.

1. What changes does PHP5.3 have?

5.3 retains the majority of forward compatibility. However, some of them are incompatible.

First, let's take a look at the incompatibility changes?

Syntax changes

This language adds namespace and closure to more reserved words. Starting from PHP V5.3, namespace is no longer used as an identifier. The closure class is now a reserved class, but it can still be used as a valid identifier.

Support for goto statements is also added in PHP V5.3. Now, goto is a reserved word. Goto statements are not very common in Modern Languages (You may remember how to use goto in BASIC), but in some cases, goto statements are indeed convenient.

Changes in functions and methods

In PHP V5.3, functions and methods have not changed significantly, but some enhancements have been made to help solve some outstanding problems in PHP and improve performance. This section discusses some significant changes.

In earlier versions of PHP, the array functions atsort, natcasesort, usort, uasort, uksort, array_flip, and array_unique can pass objects rather than arrays in the form of parameters. Then, these functions treat the object attributes as the keys and values of the array. PHP V5.3 does not support this, so you need to first convert the object to an array.

On Windows, some functions are not supported in PHP before and are now supported in PHP V5.3. For example, the getopt () function is used to parse the options used when the PHP script is called from the command line. The inet_ntop () and inet_ton () functions are used to encode and decode Internet addresses.®. There are also some mathematical functions, such as asinh (), acossh (), atanh (), log1p (), and expm1 (), which are also supported on Windows.

Scaling changes

PHP Extension C Library (PECL) has always been the source of new extensions in PHP. When an extension is mature and stable and can be considered as a useful feature in the core release, it is usually added in major version changes. According to this rule, from PHP V5.3, the following extensions will become part of the core PHP release.

FileInfo provides functions to help detect file content types and encoding. These functions detect some magic byte character sequences in the file. IntlInternational Components for Unicode (ICU) Library is a package that provides functions for unicode and global support. A PHP archive tool discussed in Phar section 4th. Mysqlnd is a local PHP driver used for MySQL database access. It is a substitute for MySQL and MySQLi extensions that used libmysql library in the early days. SQLite3 is used to use a library of the SQLite V3 database.

An extension is usually transferred to PECL when it is no longer actively maintained or deemed not worth releasing along with the core PHP release. During PHP V5.3 transformation, the following extensions were kicked out of the core PHP release and maintained in PECL.

Ncurses simulates curses and displays graphical output on the command line. Fpdf is used to construct and use form and form data in PDF documents. Dbase supports reading and writing dbase compatible files. Fbsql supports database access on the Frontbase database server. Ming is an open-source library used to create Flash 4 animations.

Sybase extensions have been completely removed and replaced by sybase_ct extensions. Sybase_ct extension is fully compatible with the former and should be a simple alternative (drop-in replacement ). This updated feature uses the Sybase client library, which needs to be installed on the Web server.

Build changes

PHP V5.3 focuses on improving the build process, so it is easier to build PHP on all platforms. To maintain consistency between PHP builds and provide a set of reliable components, PCRE, Reflection, and SPL extensions are no longer disabled during build. Now you can build distributed PHP applications that will use these extensions and ensure they are available.

A new team took over the PHP Windows build last year. This team will provide some improvements for users on Windows. The new build will be based on the 586 architecture (Intel®Pentium®Or higher) as the target, and requires Windows 2000/XP or later. In addition, the support for Windows 98/NT and earlier versions is removed. Use Microsoft®Visual Studio®2008 build PHP and x86-64 architecture. When used with FastCGI on Microsoft IIS Web server or with Apache, they provide higher performance when building with the same compiler and architecture. The Windows installer will also be improved to better configure PHP on the Microsoft IIS Web server.

. Ini changes

An important feature of PHP is that it can be configured using the. ini file. In PHP V5.3, some problematic commands related to this file have been deleted, such as zend. zemo-compatibility_mode. Now, the flexibility of this file has been greatly improved.

There are two major improvements to the php. ini file:

Variables can be used in the php. ini file. This is very convenient for reducing the file redundancy, and it is more convenient to update the file if necessary.

Like setting with the Apache configuration file, you can set per-directory and per-site PHP ini. The advantage of doing so is that the syntax is consistent among all different sapis that can run PHP.

Abandoned features

PHP V5.3 has officially abandoned some older functions and will not provide them in future PHP versions. When using these functions, the E_DEPRECATED error occurs. The following functions are abandoned in PHP V5.3:

Tick (declare (ticks = N) and register_tick_function () are used to call a function every time the parser executes n statements in the declare () block. They will be abolished because their functions have a lot of interruptions and this feature is rarely used.

Define_syslog_variables (), which initializes all syslog-related variables. This function is not required because the constant it defines has been globally defined. It is necessary to abolish this function call.

Ereg regular expression function. We recommend that you replace the PCRE Regular Expression functions because they are faster and more consistent with the regular expressions used in other languages and applications. The support for ereg functions will be abolished so that PHP can use a regular expression engine in a standardized manner.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.