开发者

Converting a string to a defined constant in PHP

Let's say I have defined the constant ERROR_0 as follows:

define("ERROR_0","An error occurred.")

Now, let's say I have the string "ERROR_0" but I want to convert that i开发者_开发技巧nto the constant ERROR_0 such that I can get the string "An Error occurred." How can I do that?

Thanks!


Use constant function

echo constant("ERROR_0");
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜