Parse Error in Class

Reply

Join Date: Jun 2009
Posts: 12
Reputation: abrocketman is an unknown quantity at this point 
Solved Threads: 0
abrocketman abrocketman is offline Offline
Newbie Poster

Parse Error in Class

 
0
  #1
24 Days Ago
I am writing this simple code. I used this class in PHP 10 minutes ago and now when I did it again it gives me this error. I cannot see the difference
  1. <?php
  2.  
  3. class user
  4. {
  5. public $Username;
  6. public $FullName;
  7. public $Password;
  8. public $LoggedIn;
  9. public $JoinDate;
  10.  
  11. public function changePassword($newPass)
  12. {
  13. $this->Password = md5($newPass);
  14. {
  15. }
  16.  
  17. $user = new user();
  18.  
  19. $user->Username = 'Username';
  20. $user->FullName = 'Name';
  21. $user->Password = 'password';
  22.  
  23. echo $user->Username;
  24. echo $user->changePassword($newPass);
  25.  
  26. ?>

This is the error I get:
Parse error: syntax error, unexpected $end in C:\xampp\htdocs\Lessons\Arrays\test.php on line 26

I would really appreicate someones help in this as I am new to OOP in PHP.

Thanks
Reply With Quote Quick reply to this message  
Join Date: Apr 2005
Posts: 1,402
Reputation: ShawnCplus is a glorious beacon of light ShawnCplus is a glorious beacon of light ShawnCplus is a glorious beacon of light ShawnCplus is a glorious beacon of light ShawnCplus is a glorious beacon of light 
Solved Threads: 225
Sponsor
ShawnCplus's Avatar
ShawnCplus ShawnCplus is offline Offline
Code Monkey
 
0
  #2
24 Days Ago
Your } for your changePassword function is a {. Also, you don't need to specify public for all of those variables, scope defaults to public.
GCS d- s+ a-->? C++(++++) UL+++ P+>+++ L+++ E--- W+++
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r y+
PMs asking for help will not be answered, post on the forums. That's what they're there for.
Reply With Quote Quick reply to this message  
Reply

Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC