Changes

Jump to: navigation, search

PHP Constants

No change in size, 18:00, 1 February 2016
m
Text replacement - "<google>ADSDAQBOX_FLOW</google>" to "<htmlet>adsdaqbox_flow</htmlet>"
== Using a Variable as a Constant Name ==
<googlehtmlet>ADSDAQBOX_FLOWadsdaqbox_flow</googlehtmlet>
It is not always the case that you want to ''hard-code'' a constant name into a script at the point you wish to access it. For example, you may have a general purpose script that you wish to perform tasks on any number of different constants, not just one that you happen to have typed in the name for. The best way to resolve this issue is store the name of the constant in a variable. How then, would you access the value assigned to that constant? The answer is to use the PHP ''constant()'' function. The ''constant()'' function takes the name of the constant as an argument and returns the value of the constant which matches that name.

Navigation menu