Converting a string to a defined constant in PHP
11,626
Use constant
function
echo constant("ERROR_0");
Related videos on Youtube
Author by
Deets McGeets
Updated on October 13, 2020Comments
-
Deets McGeets over 3 years
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 into the constant
ERROR_0
such that I can get the string "An Error occurred." How can I do that?Thanks!
-
xdazz over 12 yearsThe function is constant.
-