tags:

views:

94

answers:

5

I have php 5.2.11 on my server. Should I upgrade to the new PHP 5.3.2?

Any new features which can save my life?

Any suggesstions?

A: 

Take a look at 'changelog' and give your desicion if you really need it.

Ahmet Kakıcı
+1  A: 

I find the lambda functions very useful, especially together with array_search, array_map, array_reduce et al.

Artefacto
+3  A: 

The most notable thing is that 5.3 is faster. How much depends on your system and code, many people say it's notable.

The migration guide on http://php.net/migration53 documents changes and new features. I personally like closures/anonymous functions a lot.

johannes
Not that I'm doubting it, but do you have any sources for the performance comparison? I'd be interested to see the improvement.
nickf
@nickf mostly from talking to different users at conferences and reviwieng the commits. If you search for something like "Sebastian Bergmann benchmarks php 5.3" you should find a blog post about some artificial benchmarks.
johannes
+1  A: 

Late static binding has been the first thing which I've actually used of 5.3. Lambdas and namespaces are great, but you were able to work around their absence in prior versions.

LSB, in short, lets you access the class which was actually called when calling static functions.

<?php
class A {
    public static function who() {
        echo __CLASS__;
    }
    public static function test() {
        static::who(); // Here comes Late Static Bindings
    }
}

class B extends A {
    public static function who() {
        echo __CLASS__;
    }
}

B::test(); // "B"

AFAIK, there was no way to do this in PHP < 5.3

nickf
A: 

Upgrading to PHP 5.3 is definitely a good idea, but only if your code is PHP 5.3 compatible.

You can automate part of that testing by using the PHP 5.3 Compatibility codesniffer rules - code that passes this isn't necessarily going to work 100%, but at least you'll no longer have to worry about a lot of issues.

wimg