The Future of PHP : A Brief Look at PHP 6

Posted December 21st, 2009 by in Website Development

PHP, or PHP: Hypertext Preprocessor, is one of the most widely used scripting languages. Although originally designed for website development, PHP has evolved massively and can now also be run from the command line interface and can be used in standalone graphical applications.

The current major version is PHP 5.3, released in June 2009. The next milestone in the evolution of PHP is PHP 6, which has been in development for a number of years. PHP 6 will introduce new features, improve existing ones, and remove others.

New in PHP 6

Namespaces

Namespaces allow a developer to avoid name collisions between classes and function without having to use prefixes that can get confusing or lead to your code becoming unreadable. Namespaces allow you to safely use the same class or function names that may be used elsewhere.

<?php
namespace MyTestNamespace;
class TestClass
{
// Whatever
}

$var = new MyTestNamespace::TestClass();
?>

Improved support for Unicode

One drawback with PHP compared to Java™, for example, is the limited Unicode support. PHP 6 will has improved support for Unicode strings in many core functions and this will allow PHP to support a wider set of characters for international support.

Alternative PHP Cache (APC)

The APC opcode cache will be included in the PHP core. Although it will be disabled by default, its inclusion saves having to compile it.

Gone in PHP 6

magic_quotes

The use of magic_quotes has been discouraged for a long time. At first magic_quotes was disabled by default, and with PHP 6 the functionality is removed altogether.

register_globals

Turned off by default as of PHP 4.2, register_globals allowed for the writing of insecure scripts and will be removed in PHP 6.

register_long_arrays

register_long_arrays registers the $HTTP_*_VARS predefined variables and was introduced in PHP 5 for backwards compatibility with old scripts using these variables. You should use $_GET, $_POST etc… and this setting is removed in PHP 6.

safe_mode

According to PHP.net “The PHP safe mode is an attempt to solve the shared-server security problem. It is architecturally incorrect to try to solve this problem at the PHP level, but since the alternatives at the web server and OS levels aren’t very realistic, many people, especially ISP’s, use safe mode for now.” Safe Mode was deprecated in PHP 5.3.0 and is no longer available in PHP 6.

ASP-style tags

PHP currently allows developers to use ASP-style tags (<% … %>) but this is removed in PHP 6.

ereg

The ereg extension, which supports POSIX regular expressions is removed in PHP 6. Perl-Compatible Regular Expression (PCRE) functions such as preg_match and preg_replace should be used instead.

Conclusion

There are far more changes taking place than can be explored in this short post. No doubt PHP 6 will provide developers with some great new functionality but will break countless older scripts that rely on or make use of outdated methods.

Be Sociable, Share!



Leave a Reply

Subscribe
Get A Quote Get A Free Website Analysis
© 2009 RAM. All rights reserved. Built and Powered by WSI. | Sitemap
Web Design Huddersfield and Online Marketing Huddersfield as well as Leeds, Manchester, Sheffield & West Yorkshire

WSI Internet Consulting, The Media Centre, 7 Northumberland Street, Huddersfield, HD1 1RL
Registered in England No. 4968860, Bridge End House, Park Mount Avenue, Baildon, BD17 6DS