Your code will already do what you want. Just insert the variable inside the string, using double quotes instead of single: echo "How can I display a variable inside some html code using the echo in php? Like this: $username";
<?php
$username = $_POST['username'];
echo 'How can I display a variable '.$username.' inside some html code using the echo in php?';
?>
<i><?php echo $username; ?></i>
<html><?= $username; ?></html>echo "How can I display a variable inside some html code using the echo in php? Like this: $username";