views:

177

answers:

3

I looked at one of the post on SO about what will break when PHP6 is released. I have a few questions below about some of the stuff...

1)
{} for string offsets no longer available.
what does this mean?

2)
[] un-deprecated for accessing characters in a string.
what does this mean?

3)
var will be an alias of public, and raises E_STRICT warning.
what does this mean? I often see var $stringname in classes

4)
Fileinfo moved to the core.
what does this mean?

5)
opcode cache included in core distribution, but turned off by default.
Does this mean that there will be no reason to use an opcode cache like APC?

+2  A: 

1 - PHP that uses {} for string index will have syntax errors and refuse to compile. Change will be required.

2 - You'll no longer get deprecation warnings for using [] for string index access.

3 - You'll get a warning for using var, but it will be treated as public, you should begin to change all of your vars to public or another visibility.

4 - You no longer need to get the Fileinfo extension if you use it. It's now built-in to the core.

5 - APC will be included with the core distro, it just won't be turned on. It's essentially just bundled in.

Ben S
+3  A: 

1) Previously, you could write $someString{4} for the 4th character of $someString. From PHP6, you cannot.

2) They now approve of you writing $stringString[4] for the same purpose as point 1)

3) The "var" syntax predates visibility modifiers. They've now been around long enough that using "var" is considered bad programming, and so will mean "public" but give a warning. Eventually (i.e. PHP 7), "var" will be a syntax error.

4) The FileInfo class is now part of the core PHP system, rather than a PECL extension

5) Yes, you won't have to install APC - you can just turn on the builtin cache.

Adam Wright
As for 5, APC *is* the builtin cache.
R. Bemrose
Thanks, for #3 I have pretty much just recently started seeing people use var so I thought it was something new that I should learn about, but now I guess not
jasondavis
A: 

APC cache is two things really. Its an opcode cache but also has the functionality of a custom or user cache to put primatives in to a virtually globally accessible key value array. Will PHP6 only contain the opcode part of APC? If so, it is probably still desirable to keep using apc for its user cache.

Phil