Jump to content

Parse error: syntax error, unexpected $end in C:\xampp\htdocs\w3schools\Number


adamriley

Recommended Posts

any one care to tell me why i get this error please

 

 

----------------------

add.php

------------------------------

<?php
//get the q parameter from URL
$Number1=$_GET["num1"];
$Number2=$_GET["num2"];
// adds
$add_them = $Number1 + $Number2;
$minus_them = $Number1 - $Number2; 
$times_them = $Number1 * $Number2;
// add them all 
$all_together_echos_no_html = <<<all
$add_them </br>
$minus_them </br>
$times_them</br>
all;
// 
$questions = <<<questions
$Number1 + $Number2 </br>
$Number1 - $Number2 </br>
$Number1 "times" $Number2 </br>
$Number1 "Devide" $Number2 </br>
questions;
// 
$html = <<<html_of_page
<html>
<head>
<title></title>
</head>
<body>
<h2><b><u><center>Questions</b></u></center></h2>
<?php echo $questions ?>
<h2><b><u><center>Answers</b></u></center></h2>
<?php echo $all_together_echos_no_html ?>
</body>
</html>
html;
echo $html_of_page;
?> 

You used wrong closing identfier for last heredoc

 

$html = <<<html_of_page
<html>
<head>
<title></title>
</head>
<body>
<h2><b><u><center>Questions</b></u></center></h2>
<?php echo $questions ?>
<h2><b><u><center>Answers</b></u></center></h2>
<?php echo $all_together_echos_no_html ?>
</body>
</html>
html_of_page;
echo $html;

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.