Expected changes in PHP version 6

php and mysql

Right now the most stable version of PHP is v5.3.6 released on march 17, 2011. PHP is powerful web language which has a big community support. The most beautiful part of PHP is that it costs you nothing to download and you will get millions of tutorials and books to learn PHP. It first appeared in 1995 and since then it has gone through a long journey with many changes. Recently I found out that PHP is releasing its version 6 in the near future, as expected it will have many changes as compared to its previous version. The most expected changes are listed below.

Remember whatever you read here is only a prediction and not 100 % proven. We can only be sure when the actual end result , that is the final version 6 of PHP is released.

 

Register Globals most likely to be removed

This setting in file PHP.ini is a major security problem with PHP if turned on. This setting when turned ‘On’ tells to register the contents of the GET, POST, COOKIE, SERVER and Environment variables as global variables.

For example, http://www.xyz.com?name=joe will set $name as a global variable without any coding. That’s a really huge security risk and if removed in v6 will be highly praised.

 

Magic Quotes will also be removed

The three major function magic_quotes, magic_quotes_sybase and magic_quotes_gpc  are introduced for newbies to write SQL commands without the requirement of manual escaping. This was a mistake done by inexperienced developers  more frequently and caused a lot of security issues.

 

String Indexes  { } and [ ]

It is expected in version 6 the value of string’s character at a specified position cannot be referred by using { }. In PHP 5 it generated warning messages. The only usage will be the standard array position syntax,  [ ].

 

Unicode Support in PHP

Presently in PHP, Unicode is accessed on per request basis. It cannot be used globally  and hence it uses more resources.  It is expected that this issue would get fixed in the much awaited PHP version 6.

 

var same as public

In PHP v6 ‘var’ will be an alias of ‘public’ and will not show any warning.

 

Any return by reference will generate warning

For example function &xyz will generate warning.
Similarly $ab = & new Exclass() will generate a warning as well.

 

Other possible changes

– There will be no safe mode
– E_STRICT will be merged into E_ALL
– Ternary operator ‘?’ will work as below
$x = $_POST[‘name’] ?: ‘joe’ i.e if $x is true, $x will be equal to joe.

– Type hinted return value
– foreach multidimensional array

example-  foreach($a1 as $a2 => list($a3,$a4))

I hope PHP developing experience will certainly grow more interesting as soon as this version is out in the world.
Well I am one of those people who are eagerly waiting for the new release of PHP v6.

19 Comments

    • As i said these are the expected changes. I am sure they will have some improvement plan for OOP concept too, but right now not much known about that. In-fact i read many article on this topic and all my research suggest that the changes discussed here might come with in the version 5 of near future rather than in version 6. for example you may find these changes in 5.4 or higher.

      there is lot of confusion in the release of version 6.
      We will keep updating on any news related to version 6

    • I agree what you said. The main problem with php is its unicode support.

      according to some sources
      PHP source code itself must be encoded in an ASCII-compatible encoding and there is no way to use Unicode codepoints directly. If you want to store a character in a variable, you either have to use a short string of bytes (the encoded representation of the character) or an integer representing the character’s Unicode codepoint. But converting between a codepoint and its encoded representation requires ugly work-arounds and wrappers, as PHP itself provides no easy mechanism for doing this.

  1. PHP v6 is on hold, not currently been developed.

    The developers don’t see why of v6 when v5.X works wonderful. I agree. The changes that you are telling can be “easily” adapted to v5.x

    • Yes chema, On thing i would like to point out is that developers are in great confusion about the unicode problem, they are fixing other problems and releasing in future v5.x, so not to surprise if you see the changes in v5.x rather than expecting it in v6

  2. $x = $_POST[‘name’] ?: ‘joe’ i.e if $x is true, $x will be equal to joe.

    i.e $_POST[‘name’] is true then $_POST[‘name’] else ‘joe’

    works in current version for me

  3. I’m not really impressed by the push to move away from {} to reference string index positions. Strings are not arrays, so using similar context creates more readability problems.

    What’s the reason behind this change? Just a couple of years ago, curly braces were the preferred approach.

    • I don’t know the reason behind this change, perhaps they want to point words as array of strings and hence using the standard notation of array to access the strings

      Also they want to add extra functionality in [ ] notation like ‘susbstr’ and ‘array_slice’ directly.

  4. Why are you saying “expected” when this is 100% speculation?

    As previously mentioned 6.0 is “on hold” and I believe there was even discussion of not going to 6.0 but going to 7 or something, because of the stigma associated with 6.0 (speculation and other things like this) – that’s just my fuzzy memory though.

    This should be “changes being discussed” or “possible changes to expect in PHP’s future” and nothing relating to a version, and nothing saying “expected” – unless you are coding it and committing it yourself or know someone who is.

  5. @Mike i agree what you said. The changes are always associated with some version that’s what i thought and did writing but any way next time i will take care.

2 Trackbacks / Pingbacks

  1. Expected changes in PHP version 6 | Truelogic Blog | Internet blog
  2. abcphp.com

Leave a Reply to Ian Cancel reply

Your email address will not be published.


*


This site uses Akismet to reduce spam. Learn how your comment data is processed.