Error trying to use static var inside an array in another class var
php
Solution
`self::$_INT` is an expression, you cannot use an expression in the declaration of a property in a class, you can only use static values.
You will have to initialise `$_fields` in the constructor if you want to do this.
Like
class MyClass {
public static $_INT = 'INTEGER';
protected $_name = 'projetos';
protected $_primary = 'id';
protected $_fields;
public function __construct() {
$this->fields = Array (
Array ('id', self::$_INT)
);
}
}
Problem
Besides of talk a lot of not useful things, there goes my code: ``` 1 public static $_INT = 'INTEGER'; 2 protected $_name = 'projetos'; 3 protected $_primary = 'id'; 4 protected $_fields = Array ( Array ('id', self::$_INT) ); ``` I'm having an error on line 4.