Php - Constant

> Procedural Languages > Php

1 - About

3 - Class

Class Constants differ from normal static variables in that you don't use the $ symbol to declare or use them.

See Php - Object

class MyClass
{
    const CONSTANT = 'constant value';
 
    function showConstant() {
        echo  self::CONSTANT . "\n";
    }
}
Advertising

4 - Define