Monday, June 29, 2015

Bangla Object Oriented Programming PHP Part-06 (Class Constants)

A constant is declared with the const keyword followed by a name (is not prefixed with a dollar sign like properties). 
Syntax: const CONSTANT_NAME
The main difference between properties and constants is that the constant value cannot be changed once it is set. Constants are recognized as public, they are not defined with public, private or protected attribute. Constants are accessed via the class name in conjunction with ::(scope resolution operator)
Syntax: Class_Name::CONSTANT_NAME 
To access a class constant in a PHP script it's no need to create an object instance of the class.

How to practice tutorials…

  • Make a team with your friends (Member should be 4/5).
  • Start to practice one tutorial series along with them.
  • Don’t try to collect source code. Type the code while watching the tutorial.
  • If you face any problem, post the question in the Forum with the error codes.
  • Share that question Link with your friends or team members to solve quickly.
  • Discuss the problem in the Forum along with others - Video Guidelines.