php özellikleri vs sabit?

0 Cevap

Ben sadece alamadım,

class MyClass
{
    const constant = 'constant value';

    function showConstant() {
        echo  self::constant . "\n";
    }
}

class MyClass
{
    public $constant = 'constant value';

    function showConstant() {
        echo  $this->constant . "\n";
    }
}

Nedir temel fark? Onun değişkenler tanımlama gibi sadece aynı, değil mi?

0 Cevap