Include constant in string without concatenating

In PHP, you can include a constant in a string without concatenating it by using double quotes (") instead of single quotes (') to define the string.

For example, if you have a constant defined as:

<?php

define("MY_CONSTANT", "Hello World");

Watch a course Learn object oriented PHP

You can include it in a string as follows:

<?php

define("MY_CONSTANT", "Hello World");

echo sprintf("This is my constant: %s", MY_CONSTANT);