Const keyword

The const keyword defines a constant.
Constants are much like variables, except for the following differences:
(i) It is define must be inside the class.
(ii) A constant’s value cannot be changed after it is set.
(iii) Constants do not have a dollar sign ($) before them.

(i) Inside the class then values of the constants can be get using self keyword.
(ii) accessing the value outside the class you have to use Scope Resolution Operator ::


class Employee {
const sift = "Office timming is 10am to 6pm.";
const company_name="Company name is TCS.";
function displaysift_timming()
echo self::sift;
echo Employee::company_name;
$emp_obj = new Employee;
Output:- Company name is TCS.
Office timming is 10am to 6pm.