ThinkingMonkey
ThinkingMonkey

Reputation: 12727

Can a name used in define be redefined in php?

Can a define be redefined in PHP?

e.g.

define("__root__", "/some/path");

Can the name __root__ be redefined?

Upvotes: 0

Views: 412

Answers (3)

Joachim Isaksson
Joachim Isaksson

Reputation: 180917

http://php.net/manual/en/function.runkit-constant-redefine.php

It's there, just don't do it.

Upvotes: 3

evotopid
evotopid

Reputation: 5429

No, the idea of constants in PHP is that they can't be redefined. If you wan't to do this eventually you could use just variables or the $_GLOBALS array.

Upvotes: 1

zerkms
zerkms

Reputation: 254926

Constant is called constant because it is constant.

Upvotes: 1

Related Questions