Is there a shorter way of including PHP constant in a string? For example, instead of:
define("MYCONST","this");
echo "hello, my const is set to: " . MYCONST . ", and that is that.";
For example, I recently learned about the {} tags when including an array in a string, meaning you didn’t have to escape out. Is there a similar way to do that with constants, so that I dont have to escape out of the string everytime to include them?
i.e.
echo "hello, my const is set to: {MYCONST}, and that is that.";
..But this doesnt seem to work 🙁
No. Unfortunately you’ve got to concatenate the string if you’re wanting to use a constant within it.