PROGRAMMING

  minte9
learningjourney




R Q

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    
Last update: 466 days ago