PHP定数を文字列に含めるより短い方法はありますか? たとえば、次の代わりに:
define("MYCONST","this");
echo "hello, my const is set to: " . MYCONST . ", and that is that.";
たとえば{}
、文字列に配列を含める場合のタグについて最近知りました。つまり、エスケープする必要はありません。定数を含めるために毎回文字列からエスケープする必要がないように、定数でそれを行う同様の方法はありますか?
すなわち
echo "hello, my const is set to: {MYCONST}, and that is that.";
..しかし、これはうまくいかないようです:(