Making text bold in PHP is easy and you will find a number of tutorials that provide solutions. However, there are few tutorials that discuss how to make a variable in the middle of PHP echo or print statement bold.
Making Variable bold in PHP echo statement
To make a PHP variable in the middle of an echo or print statement bold then use the example code provided below;
$variable = “make me bold”;
echo “I want you to” . “<b> $variable, </b>” . ” so that I can look good”;
The concatenation operator (.) before and after the bold HTML tag is used to combine the variable with the rest of the string.
The comma immediately after the variable in the echo statement is for punctuation purposes only.