Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[PHP] Unexpected T_STRING

Junior Spellweaver
Joined
Sep 1, 2008
Messages
130
Reaction score
0
Hi there.

I'm following a PHP book so I can learn PHP. I've just wrote out the code it's asked me to and I'm getting a UNEXPECTED T_STRING on line 16. As I'm not good a PHP yet, I need you guys in order to help me slove it.

Heres the code.

PHP:
<html>
<head>
<title>Listing 4.2 chaning the type of a variable with settype()</title>
</head>
<body>
<?php
$undecided = 3.14;
print settype( $undecided ); // double
print " is $undecided<br>"; // 3.14
settype( $undecided, 'string' );
print gettype( $undecided ); // string
print " is $undecided<br>"; // 3.14
settype( $undecided, 'integer; );
print gettype( $undecided ); // integer
print " is $undecided<br>"; // 3
settype( $undecided, 'double' );
print gettype( $undecided ); // double
print " is $undecided<br>"; // 3.0
settype( $undecided, 'boolean' );
print gettype( $undecided ); // boolean
print " is $undecided<br>"; // 1
?>
</body>
</html>

Thanks for reading,

Edit: Not to be rude or whatever. Could someone explain why this is happening so I can get a better understanding of PHP errors. Thanks Again.
 
Joined
Dec 26, 2006
Messages
1,305
Reaction score
167
line 13
PHP:
settype( $undecided, 'integer; );
-->
PHP:
settype( $undecided, 'integer' );



Line 19
PHP:
settype( $undecided, 'boolean );
-->
PHP:
settype( $undecided, 'boolean' );

bad dude, you just forgot 2 '
 
Junior Spellweaver
Joined
Sep 1, 2008
Messages
130
Reaction score
0
Thanks for that SuperFun. And thanks for pointing out where I went wrong

I've got another error.

PHP:
Wrong parameter count for settype() on line 8
Heres the code for line eight.
PHP:
print settype( $undecided ); // double
Once again, Could you explain aswell :):

Edit. Sorted problem. i put

PHP:
settype
instead of
PHP:
gettype
 
Back
Top