Jump to content

[SOLVED] parse error, unexpected $end...Help!


Brunner41

Recommended Posts

<!DOCTYPE html PUBLIC\
"-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html>
<head>
<title>Listing 4.2 Changing the Type of a Variable with settype()</title>
</head>
<body>
<div>
<?php
$undecided = 3.14;
print gettype( $undecided ); // double
print " -- $undecided<br />"; // 3.14

' settype( $undecided, string );

print gettype( $undecided ); // string
print " -- $undecided<br />"; // 3.14

settype( $undecided, int );

print gettype( $undecided ); // integer
print " -- $undecided<br />"; // 3

settype( $undecided, double );

print gettype( $undecided ); // double
print " -- $undecided<br />"; // 3.0

settype( $undecided, bool );

print gettype( $undecided ); // boolean
print " -- $undecided<br />"; // 1
?>
</div>
</body>
</html>

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

that's my code and the error which is: parse error, unexpected $end etc etc claims to be on line 29, line 38 and some others...it appears to be kind of random

line 29 is: print " -- $undecided<br />"; // 3
and
line 38 is simply: </html>

confused?
Link to comment
https://forums.phpfreaks.com/topic/32776-solved-parse-error-unexpected-endhelp/
Share on other sites

Thankyou!

I can see how this came about. The script is actually from a book I'm working with. I think it may either be too old or have a few errors in it itself. They had the settype( $undecided, int ); without the double quote marks....and it actually came up with  error saying "expected 'int' "  so i added in some single quote marks which seemed to cause the errors I have now. I took the single quote marks away again and the parse error remained. Now I know it's double quotes in settype, not single quotes or none at all. 

Thanks a lot!!!

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.