Dynamic constant name in PHP

后端 未结 3 862
不知归路
不知归路 2020-11-27 15:54

I am trying to create a constant name dynamically and then get at the value.

define( CONSTANT_1 , \"Some value\" ) ;

// try to use it dynamically ...
$const         


        
3条回答
  •  臣服心动
    2020-11-27 16:27

    http://dk.php.net/manual/en/function.constant.php

    echo constant($constant_name);
    

提交回复
热议问题