Php versions

Upon testing a client site, I found that the host they use currently has php 5.2.

When writing php classes how should the code be treated to avoid problems in the future when going from “->” to “::” notation?

You do not need to worry about “->” and “::”, they are two completely different things.

“->” is used to access properties and methods of an instantiated object and “::” is used to access properties and methods of a static class. The way those are used will not change in the next versions.


class regularClass {
    public $foo = 'bar';

$obj = new regularClass();
echo $obj->foo; // outputs bar


class staticClass {
    public static $foo = 'bar';

echo staticClass::$foo; // outputs bar


class mixedClass {
    public static $static_foo = 'bar';
    public $regular_foo = 'bar';

$obj = new mixedClass();

echo $obj->regular_foo; // outputs bar
echo mixedClass::$static_foo; // outputs bar

JV, thank you for your answer. It helps to clear the misconception that I was thinking about.