- Joined
- Aug 11, 2023
- Messages
- 3
- Reaction score
- 0
don't display $name. what is reason?
$a_name = "Sami";
$sentenceText = 'hello by ' . $a_name . " by concatenation" ;
<html>
<head>
<title> <?php echo("Hello !"); ?> </title>
</head>
<body>
<?php echo("Why not by the body ?") ; ?>
</body>
</html>
<?php
$name = 'John';
$html = "
<!DOCTYPE html>
<html>
<head>
<title>PHP and HTML</title>
</head>
<body>
<h1>Welcome to my PHP website</h1>
<p>This is a paragraph of text $name</p>
</body>
</html>
";
echo $html;
?>
<?php
$name = 'John';
$html = "
<!DOCTYPE html>
<html>
<head>
<title>PHP and HTML</title>
</head>
<body>
<h1>Welcome to my PHP website</h1>
<p>This is a paragraph of text {$name}</p>
</body>
</html>
";
echo $html;
?>
<?php
$name = 'John';
$html = <<<END
<!DOCTYPE html>
<html>
<head>
<title>PHP and HTML</title>
</head>
<body>
<h1>Welcome to my PHP website</h1>
<p>This is a paragraph of text $name</p>
</body>
</html>
END;
echo $html;
?>
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.