In PHP constant and define are constants then I would like to introduce a method to achieve dynamic use of constant and define value method, I hope you have some help.
How do you use PHP to show or use dynamic Constant/define values? Ex: The following example is a dynamic variable, but how is dynamic Constant used?
The code is as follows |
Copy Code |
$a = ' abc '; $b = ' a '; echo $ $b; Print out ABC ?>
|
PHP uses dynamic constant/define values
You can use constant () to achieve a value using constant, as shown in the following example:
The code is as follows |
Copy Code |
Define (' PKEY1 ', ' abc '); Define (' PKEY2 ', ' def '); $i = 1; $a = ' PKEY '; ECHO constant ($a. $i); Abc ECHO constant ($a. + + $i); Def ?> |
http://www.bkjia.com/PHPjc/632795.html www.bkjia.com true http://www.bkjia.com/PHPjc/632795.html techarticle in PHP constant and define are constants then I would like to introduce a method to achieve dynamic use of constant and define value method, I hope you have some help. PHP to show or use ...