Jump to content

unexpected '('


MikeDXUNL

Recommended Posts

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

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.