Vote Up 0 Vote Down

php use class constants

How to declare constants inside class in php ?


Vote Up 0 Vote Down
You can define class constants in php like below :

class MyClass
const constant = 'constant value';

function showConstant() {
echo self::constant . "\n";

echo MyClass::constant . "\n";
flag | link |

Your Answer

Login before answering

Login with facebook