define a global constant in php

by Prakash 2013-10-05 10:41:14

We can define a global constant in php using the following way :


define('MYCONSTANT','myvalue');


This constant can be used inside functions and classes also. Trying to change this value will leads to error. It is a good practice to use global constants wherever necessary.

Tagged in:

451
like
0
dislike
0
mail
flag

You must LOGIN to add comments