Welcome! Log In Create A New Profile

Advanced

confused smiley Page , for practise, it gives me error

Posted by tmokoena 
Announcements Last Post
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
confused smiley Page , for practise, it gives me error
July 31, 2013 12:11AM
confused smileyconfused smileyhtml>
<head>
<title>
Displaying text from PHP
</title>
</head>

<body>
<h1>
Display text from PHP
</h1>
Here's what PHP has to say:
<br>
<br>
<?php
echo <<<END
This example uses
"here document" syntax to display all
the text until the ending token is reached.
END;
?>
</body>
</html>

Parse error: syntax error, unexpected $end, expecting T_VARIABLE or T_END_HEREDOC or T_DOLLAR_OPEN_CURLY_BRACES or T_CURLY_OPEN in C:\Program Files\EasyPHP-5.3.3\www\phphere.php on line 23

Where I've made wrong? please advise! Thank you.
avatar
Mac
confused smiley Re: Page , for practise, it gives me error
July 31, 2013 08:10AM
Use the formatted code button to post code here! Check for whitespace between between the identifiers
confused smiley Re: Page , for practise, it gives me error
August 01, 2013 01:00AM
Language: PHP
<html> <head> <title>Displaying text from PHP</title> </head>   <body> <h1> Display text from PHP </h1> Here';s what PHP has to say: <br> <br> <?php echo <<<END This example uses "here document" syntax to display all the text until the ending token is reached. END; ?> </body> </html>
avatar
Mac
confused smiley Re: Page , for practise, it gives me error
August 01, 2013 08:05AM
The can be no whitespace before/inside. Before echo there is whitespace. Delete the "spaces" until echo is against <?php, then use enter button to put echo on a new line, and then use the space bar (which is not the same as whitespace) to arrange the sentence. This whitespace typically appears when you copy code from a web page, for example.

Language: PHP
<?phpecho <<<EODThis"example"usesheredocumentsyntaxtodisplayallthetextuntiltheendingtokenisreached.EOD;?> <?php echo <<<EOD This "example" uses here document syntax to display all the text until the ending token is reached. EOD; ?>
Sorry, only registered users may post in this forum.

Click here to login