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.
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:
Example of defining constants in PHP
<?php
define("MY_CONSTANT", "Hello World");Info
Watch a video course: Learn object oriented PHP
You can include it in a string as follows:
Example of including constant in string without concatenating in PHP
php— editable, runs on the server