Question : Trying to add properties to a PHP5 class....

In reading the docs on PHP5 class properties, this *should* work:
1:
2:
3:
4:
5:
6:
7:
8:
// extend TCPF with custom functions
class MYPDF extends TCPDF {
  
  public $db = new Database;

  // more here
}

But, I get an unexpected T_NEW error on the declaration line.

I've also tried this, with the same error:
1:
2:
3:
4:
5:
6:
7:
8:
// extend TCPF with custom functions
class MYPDF extends TCPDF {
  
  var $db = new Database;

  // more here
}

This code:
1:
2:
3:
4:
5:
6:
7:
8:
9:
// extend TCPF with custom functions
class MYPDF extends TCPDF {

  public $db;
  $this->db = new Database;

  // more here
}

and this:
1:
2:
3:
4:
5:
6:
7:
8:
class MYPDF extends TCPDF {
  
  var $db;
  $this->db = new Database;

  // more here
}

produces this error: unexpected T_VARIABLE, expecting T_FUNCTION

Now, what exactly is the problem here as I am following the manual perfectly for either PHP4 or PHP5.

Answer : Trying to add properties to a PHP5 class....

You cant do it inside VBA as otherwise  macros would already be enabled ..... you would need a vbscript to change the registry settings

Dave


Random Solutions  
 
programming4us programming4us