MikeDXUNL Posted November 24, 2008 Share Posted November 24, 2008 line 8: protected $thisyear = date('Y')+$this->year; Parse error: syntax error, unexpected '(', expecting ',' or ';' in C:\wamp\www\fitchband\incl\calendar.class.php on line 8 help please? D: Link to comment https://forums.phpfreaks.com/topic/134069-unexpected/ Share on other sites More sharing options...
rhodesa Posted November 24, 2008 Share Posted November 24, 2008 the problem most likely occurs on the line before this one. can you post the lines 1-7? Link to comment https://forums.phpfreaks.com/topic/134069-unexpected/#findComment-697900 Share on other sites More sharing options...
MikeDXUNL Posted November 24, 2008 Author Share Posted November 24, 2008 <?php include 'incl/dbconnect.php'; class Calendar { public $offset; public $year; Link to comment https://forums.phpfreaks.com/topic/134069-unexpected/#findComment-697902 Share on other sites More sharing options...
rhodesa Posted November 24, 2008 Share Posted November 24, 2008 so, the entire code is this? <?php include 'incl/dbconnect.php'; class Calendar { public $offset; public $year; protected $thisyear = date('Y')+$this->year; you can't have formulas in class variable declarations. put them inside the constructor: <?php include 'incl/dbconnect.php'; class Calendar { public $offset; public $year; protected $thisyear; function __construct ( ) { $this->year = 2008; $this->thisyear = date('Y')+$this->year; } Link to comment https://forums.phpfreaks.com/topic/134069-unexpected/#findComment-697909 Share on other sites More sharing options...
MikeDXUNL Posted November 24, 2008 Author Share Posted November 24, 2008 that leads to the error Parse error: syntax error, unexpected T_PROTECTED in C:\wamp\www\fitchband\incl\calendar.class.php on line 9 Link to comment https://forums.phpfreaks.com/topic/134069-unexpected/#findComment-697911 Share on other sites More sharing options...
rhodesa Posted November 24, 2008 Share Posted November 24, 2008 are you running PHP4? Private/Protected are not supported until PHP5 Link to comment https://forums.phpfreaks.com/topic/134069-unexpected/#findComment-697966 Share on other sites More sharing options...
Mark1inLA Posted November 24, 2008 Share Posted November 24, 2008 oops Link to comment https://forums.phpfreaks.com/topic/134069-unexpected/#findComment-698042 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.