What is Removed From PHP 6?

  • Avinash
  • 7
  • Nov 19, 2011
  • Tutorial

In this post I am going to show you which features are removed from major release of the PHP which is PHP 6. These features are removed based on various reasons like security, incompatibility, performance, etc..

Here is the list of those features:

1) Register Globals
2) Safe Mode
3) Magic Quotes
4) Long variables ($_HTTP_*_VARS)
5) ereg removed from core
6) Short Tags

Register Globals

Main reason to remove this is the security of the PHP. If the register global is set to On then it will set all EGPCS ( Environment, Get, Post, Cookie, Server ) variables as global variable without need of the single line of code.

So for example, if your url is like “http://domain.com/index.php?name=expert-developer”; then it will set $name as global and can be accessed in whole script.

This feature is set as deprecated in PHP 5.3 and going to be removed in PHP 6.

Safe Mode

Safe mode does a user check for the files that is opened by the process. It will check the user of the file and user who runs the process. Possible probles with safe mode due to this file check are as below:

1) File Uploads
2) File Modification features like copying, moving, rename, changing ownership and changing the permission can be done with the administrative permissions only.
3) You can not use exec() and system() functions, if safe mode is on.

This feature is set as deprecated in PHP 5.3 and going to be removed in PHP 6.

Magic Quotes

Magic Quotes is a features which will automatically perfom an addslashes opration to the GET, POST and COOKIE values. But this is not the full proof solution to the SQL Injection.

To know more, please check my article on Magic Quotes in PHP.

Long Variables

In earlier verison of PHP POST and GET variables are accessed using the $HTTP_POST_VARS and $HTTP_GET_VARS respectively.

But after the introduction of PHP 4.1.0, these long variables are no longer used.

So, PHP 6 is going to remove the support for these Long Varibales.

ereg

ereg matches the string based on given regular expression in case sensitive manner.

preg_match() is become an alternative to ereg(), preg_match() is faster in terms of execution of the program than ereg().

This function is set as deprected in PHP 5.3 and going to be removed from PHP 6.

Short Tag

Short tag is method of printing variable in short manner.

Below both codes are same if short tag is enabled.

  <?php echo $name;?>
  <?=$name;?>

But it is not good to rely on this feature because configuration of the PHP can be different from one server to another. Because this can be disabled from PHP.ini.

Conclusion

What you think which feature should be removed and any other feature you wish to have in PHP 6? Yes we know that PHP people will not going consider our wishes from here. But as I say it is good to share.

Related Posts

Written by Avinash

Avinash Zala is leading various projects which deals with the various technology involved with the web. A combination of perfect technical and management skills. Avinash would like to chat with you and convert your imagination into the working system. You can get in touch with him on Facebook and Twitter.

View all posts by:

  • http://michaeldepetrillo.com michael depetrillo

    Are they really removing short tags? I love short tags why get rid of them they help me code templates much more quickly.

    • http://www.xpertdeveloper.com Avinash

      Yes its going to removed from PHP 6, so its not good to rely on that..

  • http://andrewchamp.com/ Andrew Champ

    Litering your code w/ php seems mindless to me because of a simple xml conflict (which can be fixed by printing the xml decoration)

    I believe short-tags will still work by just turning them back on. May be set off by default.

    • http://www.xpertdeveloper.com Avinash

      Short tags are no more supported from PHP 6, yes in current PHP version you can enable from php.ini

  • Knut Eirik Leira Hjelle

    PHP < 5.4.0 relied on short_open_tags to be enabled to access while PHP >= 5.4.0 always have this available. Source http://php.net/manual/en/ini.core.php

    • http://www.rutinerad.com Samuel Lindblom

      What you are saying applies to shorthand echo, but no all short open tags, according to the manual you’re linking:

      This directive also affected the shorthand <?= before PHP 5.4.0, which is identical to <? echo. Use of this shortcut required short_open_tag to be on. Since PHP 5.4.0, <?= is always available."

  • anon

    php6 is dead.