quoting constants in php: “this is a MY_CONSTANT”

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

    I recomend you to use concatenation because:

    1. When you use a variable into a double quotes string your visibility is not good;
    2. When you use a double quotes string the php can to process slowly;
    3. You don't use a constant into a string, because don't have any delimiter to the php knows what is the constant.

提交回复
热议问题