quoting constants in php: “this is a MY_CONSTANT”

前端 未结 6 1639
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-06 09:58

I want to use a constant in PHP, but I also want to put it inside double quotes like a variable. Is this at all possible?

define(\"TESTER\", \"World!\");
ech         


        
6条回答
  •  日久生厌
    2020-12-06 10:08

    Alternatively, do

    "this is " . MY_CONSTANT
    

    or

    "this is " . constant("MY_CONSTANT");
    

提交回复
热议问题