quoting constants in php: “this is a MY_CONSTANT”

前端 未结 6 1604
爱一瞬间的悲伤
爱一瞬间的悲伤 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:10

    Concatenation is the way to go.

    Unless you want the hokey, nasty, inefficient, evil monkey way of:

    echo preg_replace("/TESTER/",TESTER,$original_content);
    

提交回复
热议问题