Instantiate PHP class without `new` keyword?

Viewed 1738

I am used to the new keyword, so I was surprised to find that the following works for instantiation as well.

class MyClass
{
    const CONSTANT = 'constant value';

    function showConstant() {
        echo  self::CONSTANT;
    }
}

// $classname = new MyClass;
$classname = "MyClass";

echo $classname::CONSTANT; 

I can't seem to find any documentation pertaining to this online. Would someone help me out?

3 Answers
Related