PHP

  minte9
REMEMBERS




Last update:   29-10-2021

Class constants

Class constants are public, and accessible from all scopes.
 
class A
{
    const BAR = "Hello World";
}

echo A::BAR; // Hello World
Class constants can be define as array.
 
class A
{
    const BAR = array(1, 2, 3);
}

print_r(A::BAR); // [1, 2, 3]

Questions    
Namespaces
        A B C D E F
🔔
1/2